diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..3a27b3f --- /dev/null +++ b/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2015 Wei Wang + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/README.md b/README.md index b038976..bf5346a 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,26 @@ # VVDocumenter-Xcode [![Build Status](https://api.travis-ci.org/onevcat/VVDocumenter-Xcode.svg)](https://travis-ci.org/onevcat/VVDocumenter-Xcode) Flattr this --- +# Goodbye World + +In Xcode 8, Apple integrated a comment documentation generator plugin, which is built on top of VVDocumenter. Now this project is proud to be a part of Apple. It means you could just use the shortcut (⌥ Option + ⌘ Command + /) to add a documentation comment to your code if you are using Xcode 8 or above! + +VVDocumenter is one of my hobby projects [from 2013](https://github.com/onevcat/VVDocumenter-Xcode/commit/6a2b604713c9fb573e229daece8286dac68ac24a), back to the age of Xcode 4. It serves well for these years and I am so glad that it helps a lot of developers to improve their productivity. Since there is no need to install this plugin anymore, the development of VVDocumenter will not continue. Yes, it's time to say goodbye, with a happy ending. + +Thank you all for your selfless support to this project. Let's build more great things and make the world better in future! + ## What is this? -Writing document is so important for developing, but it is really painful with Xcode. Think about how much time you are wasting in pressing '*' or '/', and typing the parameters again and again. Now, you can find the method (or any code) you want to document to, and type in `///`, the document will be generated for you and all params and return will be extracted into a Javadoc style, which is compatible with [appledoc](https://github.com/tomaz/appledoc), [Doxygen](http://www.stack.nl/~dimitri/doxygen/) and [HeaderDoc](https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/HeaderDoc/intro/intro.html). You can just fill the inline placeholder tokens to finish your document. +Writing documentation is so important for developing, but it is really painful with Xcode. Think about how much time you are wasting in pressing '*' or '/', and typing the parameters again and again. Now, you can find the method (or any code) you want to document to, and type in `///`, the document will be generated for you and all params and return will be extracted into a Javadoc style, which is compatible with [appledoc](https://github.com/tomaz/appledoc), [Doxygen](http://www.stack.nl/~dimitri/doxygen/) and [HeaderDoc](https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/HeaderDoc/intro/intro.html). You can just fill the inline placeholder tokens to finish your document. Here is an image which can show what it exactly does. -### By the way, it also supports [Swift](https://developer.apple.com/swift/) now. Cheers! - ![Screenshot](https://raw.github.com/onevcat/VVDocumenter-Xcode/master/ScreenShot.gif) +> By the way, it also supports [Swift](https://developer.apple.com/swift/) now. Cheers! + +![Screenshot](https://raw.github.com/onevcat/VVDocumenter-Xcode/master/vvdocumenter-swift.gif) + ## How to install and use? The best way of installing is by [Alcatraz](http://alcatraz.io). Install Alcatraz followed by the instruction, restart your Xcode and press `⇧⌘9`. You can find `VVDocumenter-Xcode` in the list and click the icon on left to install. @@ -21,13 +31,23 @@ If you want to use other text beside of `///` to trigger the document insertion, ## Xcode version? -This plug-in is supported in Xcode 5 and 6 (current beta). From Xcode 5, Apple added a UUID-verification to all plugins to ensure the stability when Xcode gets updated. The value of `DVTPlugInCompatibilityUUIDs` in project plist should contains current UUID of Xcode version, or the plugin does not work. Once you update your Xcode, the plugin might be disabled and you should check the newest version and built it again. +This plug-in is supported in Xcode 5, 6 and 7. From Xcode 5, Apple added a UUID-verification to all plugins to ensure the stability when Xcode gets updated. The value of `DVTPlugInCompatibilityUUIDs` in project plist should contains current UUID of Xcode version, or the plugin does not work. And from Xcode 6.3, you will be prompt to "Load third party bundle" if you are using a plugin. You should always select "Load bundles" to enable this plugin. + +All plugins will be disabled once you update your Xcode, since the supported UUIDs in the plugins do not contain the one. You should try to clean your plugins folder (`~/Library/Application Support/Developer/Shared/Xcode/Plug-ins` by default) and clone/build the latest version from master branch. If you happened to skip the bundle loading, you can use this to reset the prompt: + +```bash +defaults delete com.apple.dt.Xcode DVTPlugInManagerNonApplePlugIns-Xcode-{your_xcode_version} +``` + +**Please do not open an issue if this plugin not work in your newly updated Xcode.** Pull request for new `DVTPlugInCompatibilityUUIDs` is welcome, and if UUID of your Xcode version is already there, please try to reinstall the plugin from a clean state. The default deployment target is 10.8. If you want to use it in a earlier OS version, you should change OS X Deployment Target (in project info setting) to your system version. ## Swift Support -Yes, this plugin supports documentation for Swift now. Check [this post](http://nshipster.com/swift-documentation/) from @mattt to see how to write the documentation for swift. By using `VVDocumenter-Xcode`, you can just type `///` to make the magic happen. +Yes, this plugin supports documentation for Swift 2 now. Check [this post](http://ericasadun.com/2015/06/14/swift-header-documentation-in-xcode-7/) to see how to write the documentation for swift. By using `VVDocumenter-Xcode`, you can just type `///` to make the magic happen. + +The documentation format changed from Swift 1.x to 2. If you are using Swift 1.x, you could build from branch [Xcode6](https://github.com/onevcat/VVDocumenter-Xcode/tree/Xcode6) to get the support for the earlier format. ## Limitations and Future @@ -42,23 +62,6 @@ If you have modified these two shortcuts in your Xcode, the newset version of th ## License -VVDocumenter is published under MIT License - - Copyright (c) 2014 Wei Wang (@onevcat) - - Permission is hereby granted, free of charge, to any person obtaining a copy of - this software and associated documentation files (the "Software"), to deal in - the Software without restriction, including without limitation the rights to use, - copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the - Software, and to permit persons to whom the Software is furnished to do so, - subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +VVDocumenter is published under MIT License. See the LICENSE file for more. + + diff --git a/VVDocumenter-Xcode.xcodeproj/project.pbxproj b/VVDocumenter-Xcode.xcodeproj/project.pbxproj index 92e8870..c79f721 100644 --- a/VVDocumenter-Xcode.xcodeproj/project.pbxproj +++ b/VVDocumenter-Xcode.xcodeproj/project.pbxproj @@ -7,8 +7,14 @@ objects = { /* Begin PBXBuildFile section */ + 4B06DF741B315E9D007D69BE /* VVSwiftExtensionCommenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B50A26F1B315CF3008A4400 /* VVSwiftExtensionCommenter.m */; }; + 4B50A2701B315CF3008A4400 /* VVSwiftExtensionCommenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B50A26F1B315CF3008A4400 /* VVSwiftExtensionCommenter.m */; }; 53C67935184501030030C553 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 893D8F7F18262EF500E8A00C /* Carbon.framework */; }; 893D8F8018262EF500E8A00C /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 893D8F7F18262EF500E8A00C /* Carbon.framework */; }; + C4052CFA1B3BB10700ED0CF0 /* VVProject.m in Sources */ = {isa = PBXBuildFile; fileRef = C4052CF71B3BB10700ED0CF0 /* VVProject.m */; }; + C4052CFB1B3BB10700ED0CF0 /* VVWorkspaceManager.m in Sources */ = {isa = PBXBuildFile; fileRef = C4052CF91B3BB10700ED0CF0 /* VVWorkspaceManager.m */; }; + C4052CFC1B3BB2C200ED0CF0 /* VVProject.m in Sources */ = {isa = PBXBuildFile; fileRef = C4052CF71B3BB10700ED0CF0 /* VVProject.m */; }; + C4052CFD1B3BB2C200ED0CF0 /* VVWorkspaceManager.m in Sources */ = {isa = PBXBuildFile; fileRef = C4052CF91B3BB10700ED0CF0 /* VVWorkspaceManager.m */; }; D114BEE0179644D00043FA65 /* NSString+PDRegex.m in Sources */ = {isa = PBXBuildFile; fileRef = D114BEDE179644D00043FA65 /* NSString+PDRegex.m */; }; D114BEE3179644FA0043FA65 /* NSTextView+VVTextGetter.m in Sources */ = {isa = PBXBuildFile; fileRef = D114BEE2179644FA0043FA65 /* NSTextView+VVTextGetter.m */; }; D11C542D17999D9000D3DE38 /* VVArgument.m in Sources */ = {isa = PBXBuildFile; fileRef = D11C542B17999D9000D3DE38 /* VVArgument.m */; }; @@ -67,7 +73,13 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 4B50A26E1B315CF3008A4400 /* VVSwiftExtensionCommenter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VVSwiftExtensionCommenter.h; sourceTree = ""; }; + 4B50A26F1B315CF3008A4400 /* VVSwiftExtensionCommenter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VVSwiftExtensionCommenter.m; sourceTree = ""; }; 893D8F7F18262EF500E8A00C /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = System/Library/Frameworks/Carbon.framework; sourceTree = SDKROOT; }; + C4052CF61B3BB10700ED0CF0 /* VVProject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VVProject.h; sourceTree = ""; }; + C4052CF71B3BB10700ED0CF0 /* VVProject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VVProject.m; sourceTree = ""; }; + C4052CF81B3BB10700ED0CF0 /* VVWorkspaceManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VVWorkspaceManager.h; sourceTree = ""; }; + C4052CF91B3BB10700ED0CF0 /* VVWorkspaceManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VVWorkspaceManager.m; sourceTree = ""; }; D114BEDD179644D00043FA65 /* NSString+PDRegex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+PDRegex.h"; sourceTree = ""; }; D114BEDE179644D00043FA65 /* NSString+PDRegex.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+PDRegex.m"; sourceTree = ""; }; D114BEE1179644FA0043FA65 /* NSTextView+VVTextGetter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSTextView+VVTextGetter.h"; sourceTree = ""; }; @@ -158,6 +170,17 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + C4052CF51B3BB10700ED0CF0 /* ProjectHelper */ = { + isa = PBXGroup; + children = ( + C4052CF61B3BB10700ED0CF0 /* VVProject.h */, + C4052CF71B3BB10700ED0CF0 /* VVProject.m */, + C4052CF81B3BB10700ED0CF0 /* VVWorkspaceManager.h */, + C4052CF91B3BB10700ED0CF0 /* VVWorkspaceManager.m */, + ); + path = ProjectHelper; + sourceTree = ""; + }; D114BEDB179644D00043FA65 /* OCCategory */ = { isa = PBXGroup; children = ( @@ -232,6 +255,7 @@ D14380FC179551B900C829CE /* VVDocumenter-Xcode */ = { isa = PBXGroup; children = ( + C4052CF51B3BB10700ED0CF0 /* ProjectHelper */, D193B8C917AC0C2400D2D76A /* Setting */, D1D66CA517A2AED700E62F99 /* KeyboardHelper */, D16AFCD11796E068006719AA /* Commenter */, @@ -283,6 +307,8 @@ D16AFCE51796E0D0006719AA /* VVEnumCommenter.m */, D16AFCE71796E0D6006719AA /* VVVariableCommenter.h */, D16AFCE81796E0D6006719AA /* VVVariableCommenter.m */, + 4B50A26E1B315CF3008A4400 /* VVSwiftExtensionCommenter.h */, + 4B50A26F1B315CF3008A4400 /* VVSwiftExtensionCommenter.m */, ); path = Commenter; sourceTree = ""; @@ -402,7 +428,6 @@ D1C462D517999C2000EB7B23 /* Sources */, D1C462D617999C2000EB7B23 /* Frameworks */, D1C462D717999C2000EB7B23 /* Resources */, - D1C462D817999C2000EB7B23 /* ShellScript */, ); buildRules = ( ); @@ -420,7 +445,7 @@ isa = PBXProject; attributes = { LastTestingUpgradeCheck = 0510; - LastUpgradeCheck = 0500; + LastUpgradeCheck = 0700; ORGANIZATIONNAME = "OneV's Den"; }; buildConfigurationList = D14380EE179551B900C829CE /* Build configuration list for PBXProject "VVDocumenter-Xcode" */; @@ -462,22 +487,6 @@ }; /* End PBXResourcesBuildPhase section */ -/* Begin PBXShellScriptBuildPhase section */ - D1C462D817999C2000EB7B23 /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "# Run the unit tests in this test bundle.\n\"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests\"\n"; - }; -/* End PBXShellScriptBuildPhase section */ - /* Begin PBXSourcesBuildPhase section */ D14380EF179551B900C829CE /* Sources */ = { isa = PBXSourcesBuildPhase; @@ -488,6 +497,7 @@ D114BEE3179644FA0043FA65 /* NSTextView+VVTextGetter.m in Sources */, D1AC3B8F1796DB070063A484 /* VVDocumenter.m in Sources */, D16AFCD41796E088006719AA /* VVBaseCommenter.m in Sources */, + 4B50A2701B315CF3008A4400 /* VVSwiftExtensionCommenter.m in Sources */, D1A6B1D0198A0D8600BCED83 /* VVSwiftPropertyCommenter.m in Sources */, D16AFCD71796E09E006719AA /* VVPropertyCommenter.m in Sources */, D16AFCDA1796E0AC006719AA /* VVMethodCommenter.m in Sources */, @@ -499,11 +509,13 @@ D16AFCE91796E0D6006719AA /* VVVariableCommenter.m in Sources */, D1C462F517999CEC00EB7B23 /* NSString+VVSyntax.m in Sources */, D1737637198A4C8A00FE2355 /* NSString+VVTextGetter.m in Sources */, + C4052CFA1B3BB10700ED0CF0 /* VVProject.m in Sources */, D1C6124819891B3700FDB554 /* VVSwiftEnumCommenter.m in Sources */, D11C542D17999D9000D3DE38 /* VVArgument.m in Sources */, D1D66CA817A2AEF000E62F99 /* VVKeyboardEventSender.m in Sources */, D173763A198A4CF700FE2355 /* VVTextResult.m in Sources */, D124614717AC16820095F9D6 /* VVDocumenterSetting.m in Sources */, + C4052CFB1B3BB10700ED0CF0 /* VVWorkspaceManager.m in Sources */, D124614817AC16820095F9D6 /* VVDSettingPanelWindowController.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -512,6 +524,9 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + C4052CFC1B3BB2C200ED0CF0 /* VVProject.m in Sources */, + C4052CFD1B3BB2C200ED0CF0 /* VVWorkspaceManager.m in Sources */, + 4B06DF741B315E9D007D69BE /* VVSwiftExtensionCommenter.m in Sources */, D173763B198A53C000FE2355 /* NSString+VVTextGetter.m in Sources */, D173763C198A53C000FE2355 /* VVTextResult.m in Sources */, D14110B81988C14500A7083F /* VVDocumenterSetting.m in Sources */, @@ -575,6 +590,7 @@ CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; + ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_OBJC_EXCEPTIONS = YES; @@ -631,6 +647,7 @@ GCC_PREFIX_HEADER = "VVDocumenter-Xcode/VVDocumenter-Xcode-Prefix.pch"; INFOPLIST_FILE = "VVDocumenter-Xcode/VVDocumenter-Xcode-Info.plist"; INSTALL_PATH = "/Library/Application Support/Developer/Shared/Xcode/Plug-ins"; + PRODUCT_BUNDLE_IDENTIFIER = "com.onevcat.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = xcplugin; }; @@ -650,6 +667,7 @@ INFOPLIST_FILE = "VVDocumenter-Xcode/VVDocumenter-Xcode-Info.plist"; INSTALL_PATH = "/Library/Application Support/Developer/Shared/Xcode/Plug-ins"; ONLY_ACTIVE_ARCH = YES; + PRODUCT_BUNDLE_IDENTIFIER = "com.onevcat.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = xcplugin; }; @@ -668,12 +686,12 @@ ); GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "VVDocumenterTests/VVDocumenterTests-Prefix.pch"; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", + HEADER_SEARCH_PATHS = ( "$(inherited)", - __DEBUG__, + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, ); INFOPLIST_FILE = "VVDocumenterTests/VVDocumenterTests-Info.plist"; + PRODUCT_BUNDLE_IDENTIFIER = "com.onevcat.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Debug; @@ -691,7 +709,13 @@ ); GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "VVDocumenterTests/VVDocumenterTests-Prefix.pch"; + HEADER_SEARCH_PATHS = ( + "$(inherited)", + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, + ); INFOPLIST_FILE = "VVDocumenterTests/VVDocumenterTests-Info.plist"; + ONLY_ACTIVE_ARCH = NO; + PRODUCT_BUNDLE_IDENTIFIER = "com.onevcat.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Release; diff --git a/VVDocumenter-Xcode.xcodeproj/xcshareddata/xcschemes/VVDocumenter-Xcode.xcscheme b/VVDocumenter-Xcode.xcodeproj/xcshareddata/xcschemes/VVDocumenter-Xcode.xcscheme index 5a92d32..78655af 100644 --- a/VVDocumenter-Xcode.xcodeproj/xcshareddata/xcschemes/VVDocumenter-Xcode.xcscheme +++ b/VVDocumenter-Xcode.xcodeproj/xcshareddata/xcschemes/VVDocumenter-Xcode.xcscheme @@ -1,6 +1,6 @@ + + + + + shouldUseLaunchSchemeArgsEnv = "YES"> @@ -39,25 +53,61 @@ + + + + + + + debugServiceExtension = "internal" + allowLocationSimulation = "YES" + viewDebuggingEnabled = "No"> + + + + + + + + + + diff --git a/VVDocumenter-Xcode.xcodeproj/xcshareddata/xcschemes/VVDocumenterTests.xcscheme b/VVDocumenter-Xcode.xcodeproj/xcshareddata/xcschemes/VVDocumenterTests.xcscheme index 8e63346..defcedc 100644 --- a/VVDocumenter-Xcode.xcodeproj/xcshareddata/xcschemes/VVDocumenterTests.xcscheme +++ b/VVDocumenter-Xcode.xcodeproj/xcshareddata/xcschemes/VVDocumenterTests.xcscheme @@ -1,16 +1,32 @@ + + + + + + + shouldUseLaunchSchemeArgsEnv = "YES"> @@ -23,24 +39,36 @@ + + + + + + +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. #import diff --git a/VVDocumenter-Xcode/Commenter/VVArgument.m b/VVDocumenter-Xcode/Commenter/VVArgument.m index 16c8143..5b1956c 100755 --- a/VVDocumenter-Xcode/Commenter/VVArgument.m +++ b/VVDocumenter-Xcode/Commenter/VVArgument.m @@ -1,10 +1,28 @@ // // Argument.m -// CommentTest +// VVDocumenter-Xcode // // Created by 王 巍 on 13-7-19. -// Copyright (c) 2013年 OneV's Den. All rights reserved. // +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. #import "VVArgument.h" diff --git a/VVDocumenter-Xcode/Commenter/VVBaseCommenter.h b/VVDocumenter-Xcode/Commenter/VVBaseCommenter.h index a91592d..d42b3b4 100755 --- a/VVDocumenter-Xcode/Commenter/VVBaseCommenter.h +++ b/VVDocumenter-Xcode/Commenter/VVBaseCommenter.h @@ -3,8 +3,26 @@ // VVDocumenter-Xcode // // Created by 王 巍 on 13-7-17. -// Copyright (c) 2013年 OneV's Den. All rights reserved. // +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. #import @@ -14,6 +32,7 @@ @property (nonatomic, copy) NSString *code; @property (nonatomic, strong) NSMutableArray *arguments; @property (nonatomic, assign) BOOL hasReturn; +@property (nonatomic, assign) BOOL hasThrows; -(instancetype) initWithIndentString:(NSString *)indent codeString:(NSString *)code; @@ -29,6 +48,7 @@ // Comment methods -(NSString *) startComment; +-(NSString *) startCommentWithDescriptionTag:(NSString *)tag; -(NSString *) argumentsComment; -(NSString *) endComment; -(NSString *) returnComment; diff --git a/VVDocumenter-Xcode/Commenter/VVBaseCommenter.m b/VVDocumenter-Xcode/Commenter/VVBaseCommenter.m index c688669..a735ff1 100755 --- a/VVDocumenter-Xcode/Commenter/VVBaseCommenter.m +++ b/VVDocumenter-Xcode/Commenter/VVBaseCommenter.m @@ -3,13 +3,32 @@ // VVDocumenter-Xcode // // Created by 王 巍 on 13-7-17. -// Copyright (c) 2013年 OneV's Den. All rights reserved. // +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. #import "VVBaseCommenter.h" #import "VVArgument.h" #import "VVDocumenterSetting.h" #import "NSString+VVSyntax.h" +#import "VVProject.h" @interface VVBaseCommenter() @property (nonatomic, copy) NSString *space; @@ -33,27 +52,82 @@ -(instancetype) initWithIndentString:(NSString *)indent codeString:(NSString *)c } -(NSString *) paramSymbol { - return self.forSwift ? @":param:" : @"@param"; + return self.forSwift ? @"- parameter" : @"@param"; } -(NSString *) returnSymbol { - return self.forSwift ? @":returns:" : @"@return"; + return self.forSwift ? @"- returns:" : @"@return"; +} + +-(NSString *) throwsSymbol { + return @"- throws:"; } --(NSString *) startComment -{ - NSString *descriptionTag = - [[VVDocumenterSetting defaultSetting] briefDescription] && !self.forSwift ? @"@brief " : @""; +-(NSString *) startCommentWithDescriptionTag:(NSString *)tag { + NSString *authorInfo = @""; + NSString *dateInfo = @""; + + if ([[VVDocumenterSetting defaultSetting] useAuthorInformation]) { + NSMutableString *authorCotent = @"".mutableCopy; + + if ([[VVDocumenterSetting defaultSetting] authorInformation].length > 0) { + [authorCotent appendString:[[VVDocumenterSetting defaultSetting] authorInformation]]; + } + + if ([[VVDocumenterSetting defaultSetting] useDateInformation]) { + NSString *formatString = [[VVDocumenterSetting defaultSetting] dateInformationFormat]; + if ([formatString length] <= 0) { + formatString = @"MM-dd-YYYY HH:MM:ss"; + } + NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; + [formatter setDateFormat:formatString]; + + dateInfo = [formatter stringFromDate:[NSDate date]]; + + if (self.forSwift) { + [authorCotent appendString: [NSString stringWithFormat:@"\n%@- date: %@", self.prefixString, dateInfo]]; + } else { + + if (authorCotent.length > 0) { + [authorCotent appendString:@", "]; + } + + [authorCotent appendString: dateInfo]; + } + + } + + if (self.forSwift) { + authorInfo = [NSString stringWithFormat:@"\n%@- author: %@\n", self.prefixString, authorCotent]; + } else { + authorInfo = [NSString stringWithFormat:@"%@@author %@\n%@\n", self.prefixString, authorCotent, self.prefixString]; + } + + } + if ([[VVDocumenterSetting defaultSetting] useHeaderDoc]) { - return [NSString stringWithFormat:@"%@/*!\n%@%@<#Description#>\n", self.indent, self.prefixString, descriptionTag]; + return [NSString stringWithFormat:@"%@/*!\n%@%@%@<#Description#>\n", self.indent, authorInfo, self.prefixString, tag]; } else if ([[VVDocumenterSetting defaultSetting] prefixWithSlashes]) { - return [NSString stringWithFormat:@"%@%@<#Description#>\n", self.prefixString, descriptionTag]; + return [NSString stringWithFormat:@"%@%@%@<#Description#>\n", self.prefixString, authorInfo, tag]; } else { - return [NSString stringWithFormat:@"%@/**\n%@%@<#Description#>\n", self.indent, self.prefixString, descriptionTag]; + + if (self.forSwift){ + return [NSString stringWithFormat:@"%@/**\n%@%@<#Description#>\n%@", self.indent, self.prefixString, tag, authorInfo]; + } else { + return [NSString stringWithFormat:@"%@/**\n%@%@%@<#Description#>\n", self.indent, authorInfo, self.prefixString, tag]; + } + } } +-(NSString *) startComment +{ + NSString *descriptionTag = + [[VVDocumenterSetting defaultSetting] briefDescription] && !self.forSwift ? @"@brief " : @""; + return [self startCommentWithDescriptionTag:descriptionTag]; +} + -(NSString *) argumentsComment { if (self.arguments.count == 0) @@ -63,22 +137,52 @@ -(NSString *) argumentsComment NSMutableString *result = [NSMutableString stringWithFormat:@"%@", self.emptyLine]; int longestNameLength = [[self.arguments valueForKeyPath:@"@max.name.length"] intValue]; - + BOOL useSpace = [[VVDocumenterSetting defaultSetting] useSpaces]; + for (VVArgument *arg in self.arguments) { NSString *name = arg.name; if ([[VVDocumenterSetting defaultSetting] alignArgumentComments]) { if (self.forSwiftEnum) { - name = [[name stringByAppendingString:@":"] stringByPaddingToLength:longestNameLength + 1 withString:@" " startingAtIndex:0]; + if (useSpace) { + name = [[name stringByAppendingString:@":"] stringByPaddingToLength:longestNameLength + 1 withString:@" " startingAtIndex:0]; + } else { + NSInteger tabSpaceRateCount = [[VVDocumenterSetting defaultSetting] spaceCount]; + NSInteger neededTabCount = (longestNameLength + tabSpaceRateCount - name.length) / tabSpaceRateCount - 1; + name = [[name stringByAppendingString:@":"] stringByPaddingToLength:(name.length + 1 + neededTabCount) withString:@"\t" startingAtIndex:0]; + } } else { - name = [name stringByPaddingToLength:longestNameLength withString:@" " startingAtIndex:0]; + if (self.forSwift) { + name = [name stringByAppendingString:@":"]; + if (useSpace) { + name = [name stringByPaddingToLength:longestNameLength + 1 withString:@" " startingAtIndex:0]; + } else { + NSInteger tabSpaceRateCount = [[VVDocumenterSetting defaultSetting] spaceCount]; + NSInteger neededTabCount = (longestNameLength + 1 + tabSpaceRateCount - name.length) / tabSpaceRateCount - 1; + name = [name stringByPaddingToLength:(name.length + neededTabCount) withString:@"\t" startingAtIndex:0]; + } + } else { + if (useSpace) { + name = [name stringByPaddingToLength:longestNameLength withString:@" " startingAtIndex:0]; + } else { + NSInteger tabSpaceRateCount = [[VVDocumenterSetting defaultSetting] spaceCount]; + NSInteger neededTabCount = (longestNameLength + tabSpaceRateCount - name.length) / tabSpaceRateCount - 1; + name = [name stringByPaddingToLength:(name.length + neededTabCount) withString:@"\t" startingAtIndex:0]; + } + } + } + } + else { + if (self.forSwiftEnum || self.forSwift) { + name = [name stringByAppendingString:@":"]; } } + NSString *indentString = useSpace ? @" " : @"\t"; if (self.forSwiftEnum) { - [result appendFormat:@"%@- %@ <#%@ description#>\n", self.prefixString, name, arg.name]; + [result appendFormat:@"%@- %@%@<#%@ description#>\n", self.prefixString, name, indentString, arg.name]; } else { - [result appendFormat:@"%@%@ %@ <#%@ description#>\n", self.prefixString, [self paramSymbol], name, arg.name]; + [result appendFormat:@"%@%@ %@%@<#%@ description#>\n", self.prefixString, [self paramSymbol], name, indentString, arg.name]; } } @@ -94,11 +198,55 @@ -(NSString *) returnComment } } +-(NSString *) throwsComment +{ + if (!self.hasThrows) { + return @""; + } else { + return [NSString stringWithFormat:@"%@%@%@ <#throws value description#>\n", self.emptyLine, self.prefixString, [self throwsSymbol]]; + } +} + -(NSString *) sinceComment { //It seems no since attribute for swift? Maybe I am wrong. + VVProject *project = [VVProject projectForKeyWindow]; + if (!self.forSwift && [[VVDocumenterSetting defaultSetting] addSinceToComments]) { - return [NSString stringWithFormat:@"%@%@@since <#version number#>\n", self.emptyLine, self.prefixString]; + + VVDSinceOption sinceOption = [[VVDocumenterSetting defaultSetting] sinceOption]; + + switch (sinceOption) { + case VVDSinceOptionPlaceholder: { + + return [NSString stringWithFormat:@"%@%@@since <#version number#>\n", self.emptyLine, self.prefixString]; + break; + } + case VVDSinceOptionProjectVersion: { + + if (project.projectVersion && project.projectVersion.length>0) { + + return [NSString stringWithFormat:@"%@%@@since <#%@#>\n", self.emptyLine, self.prefixString,project.projectVersion]; + }else{ + // Fall back onto default placeholder if no project version can be obtained. + return [NSString stringWithFormat:@"%@%@@since <#version number#>\n", self.emptyLine, self.prefixString]; + } + + break; + } + case VVDSinceOptionSpecificVersion: { + + NSString *version = [[VVDocumenterSetting defaultSetting] sinceVersion]; + if (version && version.length>0) { + + return [NSString stringWithFormat:@"%@%@@since <#%@#>\n", self.emptyLine, self.prefixString, version]; + }else{ + // Fall back onto default placeholder if no version can be obtained. + return [NSString stringWithFormat:@"%@%@@since <#version number#>\n", self.emptyLine, self.prefixString]; + } + break; + } + } } else { return @""; } @@ -134,9 +282,10 @@ -(NSString *) documentForC -(NSString *) __document { - NSString * comment = [NSString stringWithFormat:@"%@%@%@%@%@", + NSString * comment = [NSString stringWithFormat:@"%@%@%@%@%@%@", [self startComment], [self argumentsComment], + [self throwsComment], [self returnComment], [self sinceComment], [self endComment]]; @@ -187,6 +336,8 @@ -(void) parseArgumentsInputArgs:(NSString *)rawArgsCode for (__strong NSString *argumentString in argumentStrings) { VVArgument *arg = [[VVArgument alloc] init]; argumentString = [argumentString vv_stringByReplacingRegexPattern:@"=\\s*\\w*" withString:@""]; + argumentString = [argumentString vv_stringByReplacingRegexPattern:@"\\(" withString:@" "]; + argumentString = [argumentString vv_stringByReplacingRegexPattern:@"\\*" withString:@" "]; argumentString = [argumentString vv_stringByReplacingRegexPattern:@"\\s+$" withString:@""]; argumentString = [argumentString vv_stringByReplacingRegexPattern:@"\\s+" withString:@" "]; NSMutableArray *tempArgs = [[argumentString componentsSeparatedByString:@" "] mutableCopy]; diff --git a/VVDocumenter-Xcode/Commenter/VVCommenter.h b/VVDocumenter-Xcode/Commenter/VVCommenter.h index e08db23..319a130 100755 --- a/VVDocumenter-Xcode/Commenter/VVCommenter.h +++ b/VVDocumenter-Xcode/Commenter/VVCommenter.h @@ -1,10 +1,28 @@ // // VVCommenter.h -// VVCommentTest +// VVDocumenter-Xcode // // Created by 王 巍 on 13-7-18. -// Copyright (c) 2013年 OneV's Den. All rights reserved. // +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. #ifndef CommentTest_Commenter_h #define CommentTest_Commenter_h @@ -21,5 +39,6 @@ #import "VVSwiftFunctionCommenter.h" #import "VVSwiftEnumCommenter.h" #import "VVSwiftPropertyCommenter.h" +#import "VVSwiftExtensionCommenter.h" #endif diff --git a/VVDocumenter-Xcode/Commenter/VVEnumCommenter.h b/VVDocumenter-Xcode/Commenter/VVEnumCommenter.h index 2062e09..d406407 100755 --- a/VVDocumenter-Xcode/Commenter/VVEnumCommenter.h +++ b/VVDocumenter-Xcode/Commenter/VVEnumCommenter.h @@ -3,8 +3,26 @@ // VVDocumenter-Xcode // // Created by 王 巍 on 13-7-17. -// Copyright (c) 2013年 OneV's Den. All rights reserved. // +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. #import "VVBaseCommenter.h" diff --git a/VVDocumenter-Xcode/Commenter/VVEnumCommenter.m b/VVDocumenter-Xcode/Commenter/VVEnumCommenter.m index f7caf45..d06c6fe 100755 --- a/VVDocumenter-Xcode/Commenter/VVEnumCommenter.m +++ b/VVDocumenter-Xcode/Commenter/VVEnumCommenter.m @@ -3,8 +3,26 @@ // VVDocumenter-Xcode // // Created by 王 巍 on 13-7-17. -// Copyright (c) 2013年 OneV's Den. All rights reserved. // +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. #import "VVEnumCommenter.h" @@ -28,7 +46,8 @@ - (NSString *)document { NSTextCheckingResult *enumDefineResult = [enumDefineExpression firstMatchInString:self.code options:0 range:NSMakeRange(0, self.code.length)]; finalString = [finalString stringByAppendingString:[self.code substringWithRange:[enumDefineResult rangeAtIndex:0]]]; - finalString = [finalString stringByAppendingString:@"\n"]; + finalString = [finalString substringToIndex:finalString.length - 1]; + finalString = [finalString stringByAppendingString:@" {\n"]; NSString *endPattern = @"\\}\\s*;"; NSString *enumPartsString = [[self.code vv_stringByReplacingRegexPattern:enumDefinePattern withString:@""] @@ -39,7 +58,7 @@ - (NSString *)document { NSString *trimmedPart = [part stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; //Only append when there is a enum define. (In case of the last comma, followed no define) if (trimmedPart.length != 0) { - NSString *temp = [NSString stringWithFormat:@"%@%@%@", [self startComment], + NSString *temp = [NSString stringWithFormat:@"%@%@%@", [self startCommentWithDescriptionTag:@""], [self sinceComment], [self endComment]]; diff --git a/VVDocumenter-Xcode/Commenter/VVFunctionCommenter.h b/VVDocumenter-Xcode/Commenter/VVFunctionCommenter.h index b59a687..f0c3737 100755 --- a/VVDocumenter-Xcode/Commenter/VVFunctionCommenter.h +++ b/VVDocumenter-Xcode/Commenter/VVFunctionCommenter.h @@ -3,8 +3,26 @@ // VVDocumenter-Xcode // // Created by 王 巍 on 13-7-17. -// Copyright (c) 2013年 OneV's Den. All rights reserved. // +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. #import "VVBaseCommenter.h" diff --git a/VVDocumenter-Xcode/Commenter/VVFunctionCommenter.m b/VVDocumenter-Xcode/Commenter/VVFunctionCommenter.m index 248f14a..7d5701f 100755 --- a/VVDocumenter-Xcode/Commenter/VVFunctionCommenter.m +++ b/VVDocumenter-Xcode/Commenter/VVFunctionCommenter.m @@ -3,8 +3,26 @@ // VVDocumenter-Xcode // // Created by 王 巍 on 13-7-17. -// Copyright (c) 2013年 OneV's Den. All rights reserved. // +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. #import "VVFunctionCommenter.h" #import "VVArgument.h" diff --git a/VVDocumenter-Xcode/Commenter/VVMacroCommenter.h b/VVDocumenter-Xcode/Commenter/VVMacroCommenter.h index 9128c42..09b9dd5 100755 --- a/VVDocumenter-Xcode/Commenter/VVMacroCommenter.h +++ b/VVDocumenter-Xcode/Commenter/VVMacroCommenter.h @@ -3,8 +3,26 @@ // VVDocumenter-Xcode // // Created by 王 巍 on 13-7-17. -// Copyright (c) 2013年 OneV's Den. All rights reserved. // +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. #import "VVBaseCommenter.h" diff --git a/VVDocumenter-Xcode/Commenter/VVMacroCommenter.m b/VVDocumenter-Xcode/Commenter/VVMacroCommenter.m index a998c59..64c6adf 100755 --- a/VVDocumenter-Xcode/Commenter/VVMacroCommenter.m +++ b/VVDocumenter-Xcode/Commenter/VVMacroCommenter.m @@ -3,8 +3,26 @@ // VVDocumenter-Xcode // // Created by 王 巍 on 13-7-17. -// Copyright (c) 2013年 OneV's Den. All rights reserved. // +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. #import "VVMacroCommenter.h" diff --git a/VVDocumenter-Xcode/Commenter/VVMethodCommenter.h b/VVDocumenter-Xcode/Commenter/VVMethodCommenter.h index b1b2464..a030659 100755 --- a/VVDocumenter-Xcode/Commenter/VVMethodCommenter.h +++ b/VVDocumenter-Xcode/Commenter/VVMethodCommenter.h @@ -3,8 +3,26 @@ // VVDocumenter-Xcode // // Created by 王 巍 on 13-7-17. -// Copyright (c) 2013年 OneV's Den. All rights reserved. // +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. #import "VVBaseCommenter.h" diff --git a/VVDocumenter-Xcode/Commenter/VVMethodCommenter.m b/VVDocumenter-Xcode/Commenter/VVMethodCommenter.m index 3d60ce3..028dadf 100755 --- a/VVDocumenter-Xcode/Commenter/VVMethodCommenter.m +++ b/VVDocumenter-Xcode/Commenter/VVMethodCommenter.m @@ -3,8 +3,26 @@ // VVDocumenter-Xcode // // Created by 王 巍 on 13-7-17. -// Copyright (c) 2013年 OneV's Den. All rights reserved. // +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. #import "VVMethodCommenter.h" #import "VVArgument.h" diff --git a/VVDocumenter-Xcode/Commenter/VVPropertyCommenter.h b/VVDocumenter-Xcode/Commenter/VVPropertyCommenter.h index 2833199..4da87cb 100755 --- a/VVDocumenter-Xcode/Commenter/VVPropertyCommenter.h +++ b/VVDocumenter-Xcode/Commenter/VVPropertyCommenter.h @@ -3,8 +3,26 @@ // VVDocumenter-Xcode // // Created by 王 巍 on 13-7-17. -// Copyright (c) 2013年 OneV's Den. All rights reserved. // +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. #import "VVBaseCommenter.h" diff --git a/VVDocumenter-Xcode/Commenter/VVPropertyCommenter.m b/VVDocumenter-Xcode/Commenter/VVPropertyCommenter.m index 306406c..1d1413e 100755 --- a/VVDocumenter-Xcode/Commenter/VVPropertyCommenter.m +++ b/VVDocumenter-Xcode/Commenter/VVPropertyCommenter.m @@ -3,8 +3,26 @@ // VVDocumenter-Xcode // // Created by 王 巍 on 13-7-17. -// Copyright (c) 2013年 OneV's Den. All rights reserved. // +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. #import "VVPropertyCommenter.h" diff --git a/VVDocumenter-Xcode/Commenter/VVStructCommenter.h b/VVDocumenter-Xcode/Commenter/VVStructCommenter.h index 1432713..91a7355 100755 --- a/VVDocumenter-Xcode/Commenter/VVStructCommenter.h +++ b/VVDocumenter-Xcode/Commenter/VVStructCommenter.h @@ -3,8 +3,26 @@ // VVDocumenter-Xcode // // Created by 王 巍 on 13-7-17. -// Copyright (c) 2013年 OneV's Den. All rights reserved. // +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. #import "VVBaseCommenter.h" diff --git a/VVDocumenter-Xcode/Commenter/VVStructCommenter.m b/VVDocumenter-Xcode/Commenter/VVStructCommenter.m index c40f358..129c231 100755 --- a/VVDocumenter-Xcode/Commenter/VVStructCommenter.m +++ b/VVDocumenter-Xcode/Commenter/VVStructCommenter.m @@ -3,8 +3,26 @@ // VVDocumenter-Xcode // // Created by 王 巍 on 13-7-17. -// Copyright (c) 2013年 OneV's Den. All rights reserved. // +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. #import "VVStructCommenter.h" diff --git a/VVDocumenter-Xcode/Commenter/VVSwiftEnumCommenter.h b/VVDocumenter-Xcode/Commenter/VVSwiftEnumCommenter.h index 0af5f75..4c94347 100644 --- a/VVDocumenter-Xcode/Commenter/VVSwiftEnumCommenter.h +++ b/VVDocumenter-Xcode/Commenter/VVSwiftEnumCommenter.h @@ -3,8 +3,26 @@ // VVDocumenter-Xcode // // Created by 王 巍 on 14-7-30. -// Copyright (c) 2014年 OneV's Den. All rights reserved. // +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. #import "VVBaseCommenter.h" diff --git a/VVDocumenter-Xcode/Commenter/VVSwiftEnumCommenter.m b/VVDocumenter-Xcode/Commenter/VVSwiftEnumCommenter.m index 35bdedc..302823a 100644 --- a/VVDocumenter-Xcode/Commenter/VVSwiftEnumCommenter.m +++ b/VVDocumenter-Xcode/Commenter/VVSwiftEnumCommenter.m @@ -3,8 +3,26 @@ // VVDocumenter-Xcode // // Created by 王 巍 on 14-7-30. -// Copyright (c) 2014年 OneV's Den. All rights reserved. // +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. #import "VVSwiftEnumCommenter.h" #import "VVArgument.h" diff --git a/VVDocumenter-Xcode/Commenter/VVSwiftExtensionCommenter.h b/VVDocumenter-Xcode/Commenter/VVSwiftExtensionCommenter.h new file mode 100644 index 0000000..5244c06 --- /dev/null +++ b/VVDocumenter-Xcode/Commenter/VVSwiftExtensionCommenter.h @@ -0,0 +1,31 @@ +// +// VVSwiftExtensionCommenter.h +// VVDocumenter-Xcode +// +// Created by WANG WEI on 2015/06/17. +// +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import "VVBaseCommenter.h" + +@interface VVSwiftExtensionCommenter : VVBaseCommenter + +@end diff --git a/VVDocumenter-Xcode/Commenter/VVSwiftExtensionCommenter.m b/VVDocumenter-Xcode/Commenter/VVSwiftExtensionCommenter.m new file mode 100644 index 0000000..8711ea7 --- /dev/null +++ b/VVDocumenter-Xcode/Commenter/VVSwiftExtensionCommenter.m @@ -0,0 +1,40 @@ +// +// VVSwiftExtensionCommenter.m +// VVDocumenter-Xcode +// +// Created by WANG WEI on 2015/06/17. +// +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import "VVSwiftExtensionCommenter.h" + +@implementation VVSwiftExtensionCommenter +-(NSString *) document +{ + NSArray *component = [[self.code stringByReplacingOccurrencesOfString:@"{" withString:@""] componentsSeparatedByString:@":"]; + NSString *description = @"Description"; + if (component.count == 2) { + description = [component.lastObject stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; + } + + return [NSString stringWithFormat:@"// MARK: - <#%@#>", description]; +} +@end diff --git a/VVDocumenter-Xcode/Commenter/VVSwiftFunctionCommenter.h b/VVDocumenter-Xcode/Commenter/VVSwiftFunctionCommenter.h index 9f48318..440d38c 100644 --- a/VVDocumenter-Xcode/Commenter/VVSwiftFunctionCommenter.h +++ b/VVDocumenter-Xcode/Commenter/VVSwiftFunctionCommenter.h @@ -3,8 +3,26 @@ // VVDocumenter-Xcode // // Created by 王 巍 on 14-7-30. -// Copyright (c) 2014年 OneV's Den. All rights reserved. // +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. #import "VVBaseCommenter.h" diff --git a/VVDocumenter-Xcode/Commenter/VVSwiftFunctionCommenter.m b/VVDocumenter-Xcode/Commenter/VVSwiftFunctionCommenter.m index 30797cf..ca8bc5d 100644 --- a/VVDocumenter-Xcode/Commenter/VVSwiftFunctionCommenter.m +++ b/VVDocumenter-Xcode/Commenter/VVSwiftFunctionCommenter.m @@ -3,8 +3,26 @@ // VVDocumenter-Xcode // // Created by 王 巍 on 14-7-30. -// Copyright (c) 2014年 OneV's Den. All rights reserved. // +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. #import "VVSwiftFunctionCommenter.h" #import "VVArgument.h" @@ -15,13 +33,17 @@ @implementation VVSwiftFunctionCommenter -(void) captureReturnType { VVTextResult *funcParenthesesResult = [self.code vv_textResultMatchPartWithPairOpenString:@"(" closeString:@")" currentLocation:0]; - NSString * funcSignatureWithoutParams = [self.code stringByReplacingCharactersInRange:funcParenthesesResult.range withString:@""]; + NSString * funcSignatureWithoutParams = [self.code stringByReplacingCharactersInRange:funcParenthesesResult.range withString:@" "]; + + if ([funcSignatureWithoutParams vv_matchesPatternRegexPattern:@"\\s+(throws|rethrows)\\s+"]) { + self.hasThrows = YES; + } if ([funcSignatureWithoutParams vv_matchesPatternRegexPattern:@"\\s*->\\s*\\(?(\\Void?|\\(\\s*\\))\\)?\\s*[{]"]) { self.hasReturn = NO; } else if ([funcSignatureWithoutParams vv_matchesPatternRegexPattern:@"s*->\\s*"]) { self.hasReturn = YES; - } else if ([funcSignatureWithoutParams vv_matchesPatternRegexPattern:@"^\\s*(.*\\s+)?init\\s*"]) { + } else if ([funcSignatureWithoutParams vv_matchesPatternRegexPattern:@"^\\s*(.*\\s+)?(init|subscript)\\s*"]) { self.hasReturn = YES; } else { self.hasReturn = NO; @@ -30,7 +52,8 @@ -(void) captureReturnType -(void) captureParameters { - NSArray * braceGroups = [self.code vv_stringsByExtractingGroupsUsingRegexPattern:@"\\((.*)\\)"]; + VVTextResult *funcParenthesesResult = [self.code vv_textResultMatchPartWithPairOpenString:@"(" closeString:@")" currentLocation:0]; + NSArray * braceGroups = [funcParenthesesResult.string vv_stringsByExtractingGroupsUsingRegexPattern:@"\\((.*)\\)"]; if (braceGroups.count > 0) { NSString *content = braceGroups[0]; NSString *trimmed = [content stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; @@ -47,9 +70,16 @@ -(void) parseSwiftArgumentsInputArgs:(NSString *)rawArgsCode return; } - NSString *removedUnwantComma = [rawArgsCode vv_stringByReplacingRegexPattern:@"([{(].*?[^\\)}],.*?[)}])" withString:@""]; + NSString *removedUnwantComma = [rawArgsCode vv_stringByReplacingRegexPattern:@"[{].*?[^}],.*?[)}]" withString:@""]; + NSString *removedUnwantParentheses = [removedUnwantComma copy]; + + VVTextResult *parenthesesInParam = [removedUnwantComma vv_textResultMatchPartWithPairOpenString:@"(" closeString:@")" currentLocation:0]; + while (parenthesesInParam.string) { + removedUnwantParentheses = [removedUnwantParentheses stringByReplacingOccurrencesOfString:parenthesesInParam.string withString:@""]; + parenthesesInParam = [removedUnwantParentheses vv_textResultMatchPartWithPairOpenString:@"(" closeString:@")" currentLocation:0]; + } - NSArray *argumentStrings = [removedUnwantComma componentsSeparatedByString:@","]; + NSArray *argumentStrings = [removedUnwantParentheses componentsSeparatedByString:@","]; for (__strong NSString *argumentString in argumentStrings) { VVArgument *arg = [[VVArgument alloc] init]; argumentString = [argumentString vv_stringByReplacingRegexPattern:@"=\\s*\\w*" withString:@""]; diff --git a/VVDocumenter-Xcode/Commenter/VVSwiftPropertyCommenter.h b/VVDocumenter-Xcode/Commenter/VVSwiftPropertyCommenter.h index f7e63cc..28ed340 100644 --- a/VVDocumenter-Xcode/Commenter/VVSwiftPropertyCommenter.h +++ b/VVDocumenter-Xcode/Commenter/VVSwiftPropertyCommenter.h @@ -3,8 +3,26 @@ // VVDocumenter-Xcode // // Created by 王 巍 on 14-7-31. -// Copyright (c) 2014年 OneV's Den. All rights reserved. // +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. #import "VVBaseCommenter.h" diff --git a/VVDocumenter-Xcode/Commenter/VVSwiftPropertyCommenter.m b/VVDocumenter-Xcode/Commenter/VVSwiftPropertyCommenter.m index 51e0c36..5c10a3d 100644 --- a/VVDocumenter-Xcode/Commenter/VVSwiftPropertyCommenter.m +++ b/VVDocumenter-Xcode/Commenter/VVSwiftPropertyCommenter.m @@ -3,8 +3,26 @@ // VVDocumenter-Xcode // // Created by 王 巍 on 14-7-31. -// Copyright (c) 2014年 OneV's Den. All rights reserved. // +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. #import "VVSwiftPropertyCommenter.h" @@ -12,7 +30,7 @@ @implementation VVSwiftPropertyCommenter -(NSString *) document { - return [NSString stringWithFormat:@"%@/// <#Description#>", self.indent]; + return [NSString stringWithFormat:@"/// <#Description#>"]; } @end diff --git a/VVDocumenter-Xcode/Commenter/VVVariableCommenter.h b/VVDocumenter-Xcode/Commenter/VVVariableCommenter.h index 145293d..d049f61 100755 --- a/VVDocumenter-Xcode/Commenter/VVVariableCommenter.h +++ b/VVDocumenter-Xcode/Commenter/VVVariableCommenter.h @@ -3,8 +3,26 @@ // VVDocumenter-Xcode // // Created by 王 巍 on 13-7-17. -// Copyright (c) 2013年 OneV's Den. All rights reserved. // +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. #import "VVBaseCommenter.h" diff --git a/VVDocumenter-Xcode/Commenter/VVVariableCommenter.m b/VVDocumenter-Xcode/Commenter/VVVariableCommenter.m index 0b6e198..437f778 100755 --- a/VVDocumenter-Xcode/Commenter/VVVariableCommenter.m +++ b/VVDocumenter-Xcode/Commenter/VVVariableCommenter.m @@ -3,8 +3,26 @@ // VVDocumenter-Xcode // // Created by 王 巍 on 13-7-17. -// Copyright (c) 2013年 OneV's Den. All rights reserved. // +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE./ #import "VVVariableCommenter.h" diff --git a/VVDocumenter-Xcode/KeyboardHelper/VVKeyboardEventSender.h b/VVDocumenter-Xcode/KeyboardHelper/VVKeyboardEventSender.h index baee497..e500713 100644 --- a/VVDocumenter-Xcode/KeyboardHelper/VVKeyboardEventSender.h +++ b/VVDocumenter-Xcode/KeyboardHelper/VVKeyboardEventSender.h @@ -3,8 +3,26 @@ // VVDocumenter-Xcode // // Created by 王 巍 on 13-7-26. -// Copyright (c) 2013年 OneV's Den. All rights reserved. // +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. #import #import diff --git a/VVDocumenter-Xcode/KeyboardHelper/VVKeyboardEventSender.m b/VVDocumenter-Xcode/KeyboardHelper/VVKeyboardEventSender.m index 4b3a757..f2aa8e0 100644 --- a/VVDocumenter-Xcode/KeyboardHelper/VVKeyboardEventSender.m +++ b/VVDocumenter-Xcode/KeyboardHelper/VVKeyboardEventSender.m @@ -3,8 +3,26 @@ // VVDocumenter-Xcode // // Created by 王 巍 on 13-7-26. -// Copyright (c) 2013年 OneV's Den. All rights reserved. // +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. #import "VVKeyboardEventSender.h" diff --git a/VVDocumenter-Xcode/OCCategory/NSString+VVSyntax/NSString+VVSyntax.h b/VVDocumenter-Xcode/OCCategory/NSString+VVSyntax/NSString+VVSyntax.h index bd3cccc..b86d460 100755 --- a/VVDocumenter-Xcode/OCCategory/NSString+VVSyntax/NSString+VVSyntax.h +++ b/VVDocumenter-Xcode/OCCategory/NSString+VVSyntax/NSString+VVSyntax.h @@ -1,10 +1,28 @@ // // NSString+VVSyntax.h -// CommentTest +// VVDocumenter-Xcode // // Created by 王 巍 on 13-7-18. -// Copyright (c) 2013年 OneV's Den. All rights reserved. // +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. #import @@ -23,5 +41,6 @@ -(BOOL) vv_isSwiftFunction; -(BOOL) vv_isSwiftEnum; -(BOOL) vv_isSwiftProperty; +-(BOOL) vv_isSwiftExtension; @end \ No newline at end of file diff --git a/VVDocumenter-Xcode/OCCategory/NSString+VVSyntax/NSString+VVSyntax.m b/VVDocumenter-Xcode/OCCategory/NSString+VVSyntax/NSString+VVSyntax.m index 45bd07d..d3d1abc 100755 --- a/VVDocumenter-Xcode/OCCategory/NSString+VVSyntax/NSString+VVSyntax.m +++ b/VVDocumenter-Xcode/OCCategory/NSString+VVSyntax/NSString+VVSyntax.m @@ -1,19 +1,37 @@ // // NSString+VVSyntax.m -// CommentTest +// VVDocumenter-Xcode // // Created by 王 巍 on 13-7-18. -// Copyright (c) 2013年 OneV's Den. All rights reserved. // +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. #import "NSString+VVSyntax.h" @implementation NSString (VVSyntax) - -(NSString *) vv_stringByConvertingToUniform { - return [[self vv_stringByReplacingRegexPattern:@"\\s*(\\(.*\?\\))\\s*" withString:@"$1"] - vv_stringByReplacingRegexPattern:@"\\s*\n\\s*" withString:@" "]; + return [[[self vv_stringByReplacingRegexPattern:@"\\s*\\(" withString:@"("] + vv_stringByReplacingRegexPattern:@"\\)\\s*" withString:@")"] + vv_stringByReplacingRegexPattern:@"\\s*\n\\s*" withString:@" "]; } -(NSString *) vv_stringByTrimEndSpaces @@ -71,17 +89,30 @@ -(BOOL) vv_isComplieKeyword -(BOOL) vv_isSwiftFunction { - return ![self vv_isObjCMethod] && ![self vv_isSwiftProperty] && [self vv_matchesPatternRegexPattern:@"^\\s*(.*\\s+)?(func\\s+)|(init|deinit)"]; + return ![self vv_isObjCMethod] && ![self vv_isSwiftProperty] && [self vv_matchesPatternRegexPattern:@"^\\s*(.*\\s+)?(func\\s+)|(init|deinit|subscript)"]; } -(BOOL) vv_isSwiftEnum { - return [self vv_matchesPatternRegexPattern:@"^\\s*(.*\\s+)?enum\\s+"]; + return ![self vv_isSwiftProperty] && [self vv_matchesPatternRegexPattern:@"^\\s*(.*\\s+)?enum\\s+"]; } -(BOOL) vv_isSwiftProperty { - return [self vv_matchesPatternRegexPattern:@"^\\s*(.*?)(\\s*let|var\\s*)\\s+"]; + // Opt out the situation of `class func` + if ([self vv_matchesPatternRegexPattern:@"class func"]) { + return NO; + } + + // `let`/`var` can be in swift func, but `(` appear before `let`/`var` only + // happens when `private(set)` or `internal(set)` is used + // typealias is considered to share the same comment as property. + return [self vv_matchesPatternRegexPattern:@"^\\s*([^(]*?)(((\\s*let|var|typealias|class\\s*)\\s+)|(\\(\\s*set\\s*\\)))"]; +} + +-(BOOL) vv_isSwiftExtension +{ + return [self vv_matchesPatternRegexPattern:@"^\\s*(.*\\s+)?extension\\s+"]; } @end diff --git a/VVDocumenter-Xcode/OCCategory/NSString+VVTextGetter/NSString+VVTextGetter.h b/VVDocumenter-Xcode/OCCategory/NSString+VVTextGetter/NSString+VVTextGetter.h index 383664d..03372ce 100644 --- a/VVDocumenter-Xcode/OCCategory/NSString+VVTextGetter/NSString+VVTextGetter.h +++ b/VVDocumenter-Xcode/OCCategory/NSString+VVTextGetter/NSString+VVTextGetter.h @@ -3,8 +3,26 @@ // VVDocumenter-Xcode // // Created by 王 巍 on 14-7-31. -// Copyright (c) 2014年 OneV's Den. All rights reserved. // +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. #import @@ -27,4 +45,6 @@ -(VVTextResult *) vv_textResultMatchPartWithPairOpenString:(NSString *)open closeString:(NSString *)close currentLocation:(NSInteger)location; + +-(VVTextResult *) vv_textResultToEndOfFileCurrentLocation:(NSInteger)location; @end diff --git a/VVDocumenter-Xcode/OCCategory/NSString+VVTextGetter/NSString+VVTextGetter.m b/VVDocumenter-Xcode/OCCategory/NSString+VVTextGetter/NSString+VVTextGetter.m index 39fc724..663b8ac 100644 --- a/VVDocumenter-Xcode/OCCategory/NSString+VVTextGetter/NSString+VVTextGetter.m +++ b/VVDocumenter-Xcode/OCCategory/NSString+VVTextGetter/NSString+VVTextGetter.m @@ -3,8 +3,26 @@ // VVDocumenter-Xcode // // Created by 王 巍 on 14-7-31. -// Copyright (c) 2014年 OneV's Den. All rights reserved. // +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. #import "NSString+VVTextGetter.h" #import "VVTextResult.h" @@ -95,9 +113,9 @@ -(VVTextResult *) vv_textResultUntilNextString:(NSString *)findString currentLoc NSRange rangeToString = [self rangeOfString:findString options:0 range:range]; NSString *line = nil; - if (nextLineRange.location != NSNotFound && rangeToString.location != NSNotFound && nextLineRange.location < rangeToString.location) { + if (nextLineRange.location != NSNotFound && rangeToString.location != NSNotFound && nextLineRange.location <= rangeToString.location) { NSRange lineRange = NSMakeRange(nextLineRange.location + 1, rangeToString.location - nextLineRange.location); - if (lineRange.location < [self length] && NSMaxRange(lineRange) < [self length]) { + if (lineRange.location < [self length] && NSMaxRange(lineRange) <= [self length]) { line = [self substringWithRange:lineRange]; return [[VVTextResult alloc] initWithRange:lineRange string:line]; } else { @@ -122,6 +140,13 @@ -(VVTextResult *) vv_textResultWithPairOpenString:(NSString *)open return [self textResultWithPairOpenString:open closeString:close currentLocation:location extractMatch:NO]; } +-(VVTextResult *) vv_textResultToEndOfFileCurrentLocation:(NSInteger)location +{ + NSRange range = NSMakeRange(location, self.length - location); + VVTextResult *result = [[VVTextResult alloc] initWithRange:range string:[self substringWithRange:range]]; + return result; +} + -(VVTextResult *) textResultWithPairOpenString:(NSString *)open closeString:(NSString *)close currentLocation:(NSInteger)location @@ -191,7 +216,7 @@ -(VVTextResult *) textResultWithPairOpenString:(NSString *)open resultRange = NSMakeRange(nextLineRange.location + 1, targetRange.location - nextLineRange.location); } - if (resultRange.location < [self length] && NSMaxRange(resultRange) < [self length]) { + if (resultRange.location < [self length] && NSMaxRange(resultRange) <= [self length]) { NSString *result = [self substringWithRange:resultRange]; return [[VVTextResult alloc] initWithRange:resultRange string:result]; } else { diff --git a/VVDocumenter-Xcode/OCCategory/NSTextView+VVTextGetter/NSTextView+VVTextGetter.h b/VVDocumenter-Xcode/OCCategory/NSTextView+VVTextGetter/NSTextView+VVTextGetter.h index d26b8ed..949affc 100755 --- a/VVDocumenter-Xcode/OCCategory/NSTextView+VVTextGetter/NSTextView+VVTextGetter.h +++ b/VVDocumenter-Xcode/OCCategory/NSTextView+VVTextGetter/NSTextView+VVTextGetter.h @@ -3,8 +3,26 @@ // VVDocumenter-Xcode // // Created by 王 巍 on 13-7-17. -// Copyright (c) 2013年 OneV's Den. All rights reserved. // +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. #import @@ -23,4 +41,5 @@ -(VVTextResult *) vv_textResultWithPairOpenString:(NSString *)open closeString:(NSString *)close; +-(VVTextResult *) vv_textResultToEndOfFile; @end diff --git a/VVDocumenter-Xcode/OCCategory/NSTextView+VVTextGetter/NSTextView+VVTextGetter.m b/VVDocumenter-Xcode/OCCategory/NSTextView+VVTextGetter/NSTextView+VVTextGetter.m index fccd5f4..54e5abd 100755 --- a/VVDocumenter-Xcode/OCCategory/NSTextView+VVTextGetter/NSTextView+VVTextGetter.m +++ b/VVDocumenter-Xcode/OCCategory/NSTextView+VVTextGetter/NSTextView+VVTextGetter.m @@ -3,8 +3,26 @@ // VVDocumenter-Xcode // // Created by 王 巍 on 13-7-17. -// Copyright (c) 2013年 OneV's Den. All rights reserved. // +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. #import "NSTextView+VVTextGetter.h" #import "VVTextResult.h" @@ -36,10 +54,14 @@ -(VVTextResult *) vv_textResultUntilNextString:(NSString *)findString return [self.textStorage.string vv_textResultUntilNextString:findString currentLocation:[self vv_currentCurseLocation]]; } - -(VVTextResult *) vv_textResultWithPairOpenString:(NSString *)open closeString:(NSString *)close { return [self.textStorage.string vv_textResultWithPairOpenString:open closeString:close currentLocation:[self vv_currentCurseLocation]]; } +-(VVTextResult *) vv_textResultToEndOfFile +{ + return [self.textStorage.string vv_textResultToEndOfFileCurrentLocation:[self vv_currentCurseLocation]]; +} + @end diff --git a/VVDocumenter-Xcode/OCCategory/VVTextResult.h b/VVDocumenter-Xcode/OCCategory/VVTextResult.h index bd84eef..8f5caa5 100644 --- a/VVDocumenter-Xcode/OCCategory/VVTextResult.h +++ b/VVDocumenter-Xcode/OCCategory/VVTextResult.h @@ -3,8 +3,26 @@ // VVDocumenter-Xcode // // Created by 王 巍 on 14-7-31. -// Copyright (c) 2014年 OneV's Den. All rights reserved. // +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. #import diff --git a/VVDocumenter-Xcode/OCCategory/VVTextResult.m b/VVDocumenter-Xcode/OCCategory/VVTextResult.m index 27b1ef8..d3afed9 100644 --- a/VVDocumenter-Xcode/OCCategory/VVTextResult.m +++ b/VVDocumenter-Xcode/OCCategory/VVTextResult.m @@ -3,8 +3,26 @@ // VVDocumenter-Xcode // // Created by 王 巍 on 14-7-31. -// Copyright (c) 2014年 OneV's Den. All rights reserved. // +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. #import "VVTextResult.h" diff --git a/VVDocumenter-Xcode/ProjectHelper/VVProject.h b/VVDocumenter-Xcode/ProjectHelper/VVProject.h new file mode 100644 index 0000000..6e9541c --- /dev/null +++ b/VVDocumenter-Xcode/ProjectHelper/VVProject.h @@ -0,0 +1,48 @@ +// +// VVProject.h +// VVDocumenter-Xcode +// +// Created by 夏天味道 on 15/6/25. +// +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import + +@interface VVProject : NSObject + +@property (nonatomic, copy) NSString *directoryPath; + +@property (nonatomic,copy,readonly) NSString *workspacePath; + +@property (nonatomic, copy) NSString *projectName; + +@property (nonatomic, copy) NSDictionary *infoDictionary; + +@property (nonatomic, copy) NSString *projectVersion; + +@property (nonatomic,copy) NSDictionary *pbxprojDictionary; + +@property (nonatomic,copy) NSString *organizeationName; + + ++ (instancetype)projectForKeyWindow; + +@end diff --git a/VVDocumenter-Xcode/ProjectHelper/VVProject.m b/VVDocumenter-Xcode/ProjectHelper/VVProject.m new file mode 100644 index 0000000..66a783e --- /dev/null +++ b/VVDocumenter-Xcode/ProjectHelper/VVProject.m @@ -0,0 +1,130 @@ +// +// VVProject.m +// VVDocumenter-Xcode +// +// Created by 夏天味道 on 15/6/25. +// +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import "VVProject.h" +#import "VVWorkspaceManager.h" + +@implementation VVProject + ++ (instancetype)projectForKeyWindow +{ + id workspace = [VVWorkspaceManager workspaceForKeyWindow]; + + id contextManager = [workspace valueForKey:@"_runContextManager"]; + + for (id scheme in[contextManager valueForKey:@"runContexts"]) { + NSString *schemeName = [scheme valueForKey:@"name"]; + if (![schemeName hasPrefix:@"Pods-"]) { + NSString *path = [VVWorkspaceManager directoryPathForWorkspace:workspace]; + return [[VVProject alloc] initWithName:schemeName path:path]; + } + } + + return nil; +} + +- (id)initWithName:(NSString *)name + path:(NSString *)path +{ + if (self = [self init]) { + _projectName = name; + _directoryPath = path; + + + NSString *pbxprojPath = [path stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.xcodeproj/project.pbxproj",name]]; + _pbxprojDictionary = [NSDictionary dictionaryWithContentsOfFile:pbxprojPath]; + + + + _organizeationName = [self getOrganizeationName]; + NSString *infoplistName = [self infoplistNameWithAtScheme:name]; + + NSString *infoPath = [path stringByAppendingPathComponent:[NSString stringWithFormat:@"%@", infoplistName]]; + + + _infoDictionary = [NSDictionary dictionaryWithContentsOfFile:infoPath]; + + _projectVersion = self.infoDictionary[@"CFBundleShortVersionString"]; + } + + return self; +} + +-(NSString *)getOrganizeationName{ + NSDictionary *objects = [_pbxprojDictionary objectForKey:@"objects"]; + NSString *rootObjectId = [_pbxprojDictionary objectForKey:@"rootObject"]; + + NSDictionary *pbxProjectDic = [objects objectForKey:rootObjectId]; + NSDictionary *attributes = [pbxProjectDic objectForKey:@"attributes"]; + NSString *organizeationName = [attributes objectForKey:@"ORGANIZATIONNAME"]; + return organizeationName; +} + +-(NSString *)infoplistNameWithAtScheme:(NSString *)currentSchemeName{ + NSDictionary *objects = [_pbxprojDictionary objectForKey:@"objects"]; + NSString *rootObjectId = [_pbxprojDictionary objectForKey:@"rootObject"]; + + NSDictionary *pbxProjectDic = [objects objectForKey:rootObjectId]; + NSArray *targetIds = [pbxProjectDic objectForKey:@"targets"]; + NSString *currentTargetId; + for (NSString *targetId in targetIds) { + NSDictionary *targetDic = [objects objectForKey:targetId]; + NSString *targetName = [targetDic objectForKey:@"name"]; + if ([targetName isEqualToString:currentSchemeName]) { + currentTargetId = targetId; + break; + } + } + if (!currentTargetId) { + currentTargetId = [targetIds firstObject]; + } + + NSDictionary *targetDic = [objects objectForKey:currentTargetId]; + NSString *buildConfigurationListId = [targetDic objectForKey:@"buildConfigurationList"]; + + NSDictionary *buildConfigurationListDic = [objects objectForKey:buildConfigurationListId]; + NSArray *buildConfigurationIds = [buildConfigurationListDic objectForKey:@"buildConfigurations"]; + + NSString *debugBuildConfigurationId; + for (NSString *buildConfigurationId in buildConfigurationIds) { + NSDictionary *buildConfigurationDic = [objects objectForKey:buildConfigurationId]; + NSString *name = [buildConfigurationDic objectForKey:@"name"]; + if ([name isEqualToString:@"Debug"]) { + debugBuildConfigurationId = buildConfigurationId; + break; + } + } + if (!debugBuildConfigurationId) { + debugBuildConfigurationId = [buildConfigurationIds firstObject]; + } + + NSDictionary *buildConfigurationDic = [objects objectForKey:debugBuildConfigurationId]; + NSDictionary *buildSettings = [buildConfigurationDic objectForKey:@"buildSettings"]; + NSString *infoplistName = [buildSettings objectForKey:@"INFOPLIST_FILE"]; + return infoplistName; +} + +@end diff --git a/VVDocumenter-Xcode/ProjectHelper/VVWorkspaceManager.h b/VVDocumenter-Xcode/ProjectHelper/VVWorkspaceManager.h new file mode 100644 index 0000000..0ea8539 --- /dev/null +++ b/VVDocumenter-Xcode/ProjectHelper/VVWorkspaceManager.h @@ -0,0 +1,36 @@ +// +// VVWorkspaceManager.h +// VVDocumenter-Xcode +// +// Created by 夏天味道 on 15/6/25. +// +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import + +@interface VVWorkspaceManager : NSObject + ++ (id)workspaceForKeyWindow; + ++ (NSString *)currentWorkspaceDirectoryPath; ++ (NSString *)directoryPathForWorkspace:(id)workspace; + +@end diff --git a/VVDocumenter-Xcode/ProjectHelper/VVWorkspaceManager.m b/VVDocumenter-Xcode/ProjectHelper/VVWorkspaceManager.m new file mode 100644 index 0000000..9de2b69 --- /dev/null +++ b/VVDocumenter-Xcode/ProjectHelper/VVWorkspaceManager.m @@ -0,0 +1,61 @@ +// +// VVWorkspaceManager.m +// VVDocumenter-Xcode +// +// Created by 夏天味道 on 15/6/25. +// +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import "VVWorkspaceManager.h" + +@implementation VVWorkspaceManager + ++ (NSString *)currentWorkspaceDirectoryPath +{ + return [self directoryPathForWorkspace:[self workspaceForKeyWindow]]; +} + ++ (NSString *)directoryPathForWorkspace:(id)workspace +{ + NSString *workspacePath = [[workspace valueForKey:@"representingFilePath"] valueForKey:@"_pathString"]; + return [workspacePath stringByDeletingLastPathComponent]; +} + +#pragma mark - Private + ++ (id)workspaceForKeyWindow +{ + return [self workspaceForWindow:[NSApp keyWindow]]; +} + ++ (id)workspaceForWindow:(NSWindow *)window +{ + NSArray *workspaceWindowControllers = [NSClassFromString(@"IDEWorkspaceWindowController") valueForKey:@"workspaceWindowControllers"]; + + for (id controller in workspaceWindowControllers) { + if ([[controller valueForKey:@"window"] isEqual:window]) { + return [controller valueForKey:@"_workspace"]; + } + } + return nil; +} + +@end diff --git a/VVDocumenter-Xcode/Setting/VVDSettingPanelWindowController.h b/VVDocumenter-Xcode/Setting/VVDSettingPanelWindowController.h index d243ada..43c1fca 100644 --- a/VVDocumenter-Xcode/Setting/VVDSettingPanelWindowController.h +++ b/VVDocumenter-Xcode/Setting/VVDSettingPanelWindowController.h @@ -3,8 +3,26 @@ // VVDocumenter-Xcode // // Created by 王 巍 on 13-8-3. -// Copyright (c) 2013年 OneV's Den. All rights reserved. // +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. #import diff --git a/VVDocumenter-Xcode/Setting/VVDSettingPanelWindowController.m b/VVDocumenter-Xcode/Setting/VVDSettingPanelWindowController.m index 1aed811..450c065 100644 --- a/VVDocumenter-Xcode/Setting/VVDSettingPanelWindowController.m +++ b/VVDocumenter-Xcode/Setting/VVDSettingPanelWindowController.m @@ -3,8 +3,26 @@ // VVDocumenter-Xcode // // Created by 王 巍 on 13-8-3. -// Copyright (c) 2013年 OneV's Den. All rights reserved. // +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. #import "VVDSettingPanelWindowController.h" #import "VVDocumenterSetting.h" @@ -17,15 +35,22 @@ @interface VVDSettingPanelWindowController () @property (weak) IBOutlet NSStepper *stepperCount; +@property (weak) IBOutlet NSMatrix *mtxSinceOptions; @property (weak) IBOutlet NSMatrix *mtxPrefixOptions; @property (weak) IBOutlet NSButtonCell *btnPrefixWithWhitespace; @property (weak) IBOutlet NSButtonCell *btnPrefixWithStar; @property (weak) IBOutlet NSButtonCell *btnPrefixWithSlashes; -@property (assign) IBOutlet NSButton *btnAddSinceToComment; +@property (weak) IBOutlet NSButton *btnAddSinceToComment; @property (weak) IBOutlet NSButton *btnBriefDescription; @property (weak) IBOutlet NSButton *btnUseHeaderDoc; @property (weak) IBOutlet NSButton *btnBlankLinesBetweenSections; @property (weak) IBOutlet NSButton *btnAlightArgumentComments; +@property (weak) IBOutlet NSButton *btnUseAuthorInformation; +@property (weak) IBOutlet NSButton *btnUseDateInformation; +@property (weak) IBOutlet NSTextField *tfAuthoInformation; +@property (weak) IBOutlet NSTextField *tfDateInformaitonFormat; +@property (weak) IBOutlet NSTextField *tfSinceVersion; + @end @implementation VVDSettingPanelWindowController @@ -49,11 +74,20 @@ - (void)windowDidLoad self.btnUseSpaces.state = (NSCellStateValue)[[VVDocumenterSetting defaultSetting] useSpaces]; self.btnAddSinceToComment.state = (NSCellStateValue)[[VVDocumenterSetting defaultSetting] addSinceToComments]; + self.mtxSinceOptions.enabled = [[VVDocumenterSetting defaultSetting] addSinceToComments]; + [self.mtxSinceOptions selectCellAtRow:(NSInteger)[[VVDocumenterSetting defaultSetting] sinceOption] column:0]; + self.tfSinceVersion.enabled = [[VVDocumenterSetting defaultSetting] addSinceToComments]; + self.tfSinceVersion.stringValue = [[VVDocumenterSetting defaultSetting] sinceVersion]; + self.btnBriefDescription.state = (NSCellStateValue)[[VVDocumenterSetting defaultSetting] briefDescription]; self.btnUseHeaderDoc.state = (NSCellStateValue)[[VVDocumenterSetting defaultSetting] useHeaderDoc]; self.btnBlankLinesBetweenSections.state = (NSCellStateValue)[[VVDocumenterSetting defaultSetting] blankLinesBetweenSections]; self.btnAlightArgumentComments.state = (NSCellStateValue)[[VVDocumenterSetting defaultSetting] alignArgumentComments]; - + self.btnUseAuthorInformation.state = (NSCellStateValue)[[VVDocumenterSetting defaultSetting] useAuthorInformation]; + self.tfAuthoInformation.stringValue = [[VVDocumenterSetting defaultSetting] authorInformation]; + self.btnUseDateInformation.state = (NSCellStateValue)[[VVDocumenterSetting defaultSetting] useDateInformation]; + self.tfDateInformaitonFormat.stringValue = [[VVDocumenterSetting defaultSetting] dateInformationFormat]; + if ([[VVDocumenterSetting defaultSetting] prefixWithStar]) { [self.mtxPrefixOptions selectCell:self.btnPrefixWithStar]; } else if ([[VVDocumenterSetting defaultSetting] prefixWithSlashes]) { @@ -71,6 +105,9 @@ - (void)windowDidLoad [self syncSpaceCount]; self.tfTrigger.delegate = self; + self.tfDateInformaitonFormat.delegate = self; + self.tfAuthoInformation.delegate = self; + self.tfSinceVersion.delegate = self; } - (IBAction)stepperPressed:(id)sender { @@ -85,29 +122,45 @@ - (IBAction)btnResetPressed:(id)sender { [[VVDocumenterSetting defaultSetting] setPrefixWithStar:YES]; [[VVDocumenterSetting defaultSetting] setPrefixWithSlashes:NO]; [[VVDocumenterSetting defaultSetting] setAddSinceToComments:NO]; + [[VVDocumenterSetting defaultSetting] setSinceVersion:@""]; [[VVDocumenterSetting defaultSetting] setBriefDescription:NO]; [[VVDocumenterSetting defaultSetting] setUseHeaderDoc:NO]; [[VVDocumenterSetting defaultSetting] setBlankLinesBetweenSections:YES]; [[VVDocumenterSetting defaultSetting] setAlignArgumentComments:YES]; - + [[VVDocumenterSetting defaultSetting] setUseAuthorInformation:NO]; + [[VVDocumenterSetting defaultSetting] setAuthorInformation:VVDDefaultAuthorString]; + [[VVDocumenterSetting defaultSetting] setUseDateInformation:NO]; + [[VVDocumenterSetting defaultSetting] setDateInformationFormat:VVDDefaultDateInfomationFormat]; + self.btnUseSpaces.state = NSOnState; [self updateUseSpace:self.btnUseSpaces.state]; self.btnPrefixWithWhitespace.state = NSOffState; self.btnPrefixWithStar.state = NSOnState; self.btnPrefixWithSlashes.state = NSOffState; self.btnAddSinceToComment.state = NSOffState; + self.tfSinceVersion.enabled = NO; + self.mtxSinceOptions.enabled = NO; self.btnBriefDescription.state = NSOffState; [self.tfTrigger setStringValue:VVDDefaultTriggerString]; self.btnUseHeaderDoc.state = NSOffState; self.btnBlankLinesBetweenSections.state = NSOnState; self.btnAlightArgumentComments.state = NSOnState; - + self.btnUseAuthorInformation.state = NSOffState; + self.tfAuthoInformation.stringValue = VVDDefaultAuthorString; + self.btnUseDateInformation.state = NSOffState; + self.tfDateInformaitonFormat.stringValue = VVDDefaultDateInfomationFormat; + self.btnPrefixWithSlashes.enabled = YES; [self syncSpaceCount]; } +- (IBAction)mtxSinceOptionPressed:(id)sender { + VVDSinceOption option = self.mtxSinceOptions.selectedRow; + [[VVDocumenterSetting defaultSetting] setSinceOption:option]; +} + - (IBAction)btnUseSpacesPressed:(id)sender { [[VVDocumenterSetting defaultSetting] setUseSpaces:self.btnUseSpaces.state]; [self updateUseSpace:self.btnUseSpaces.state]; @@ -121,13 +174,24 @@ - (IBAction)mtxPrefixSettingPressed:(id)sender { } - (IBAction)btnAddSinceToCommentsPressed:(id)sender { - [[VVDocumenterSetting defaultSetting] setAddSinceToComments:self.btnAddSinceToComment.state]; + BOOL enableSince = self.btnAddSinceToComment.state; + [[VVDocumenterSetting defaultSetting] setAddSinceToComments:enableSince]; + self.tfSinceVersion.enabled = enableSince; + self.mtxSinceOptions.enabled = enableSince; } - (IBAction)btnBriefDescriptionPressed:(id)sender { [[VVDocumenterSetting defaultSetting] setBriefDescription:self.btnBriefDescription.state]; } +- (IBAction)btnUseAuthorInformationPressed:(id)sender { + [[VVDocumenterSetting defaultSetting] setUseAuthorInformation:self.btnUseAuthorInformation.state]; +} + +- (IBAction)btnUseDateInformationPressed:(id)sender { + [[VVDocumenterSetting defaultSetting] setUseDateInformation:self.btnUseDateInformation.state]; +} + -(void) syncSpaceCount { NSInteger spaceCount = [[VVDocumenterSetting defaultSetting] spaceCount]; @@ -147,6 +211,15 @@ - (void)controlTextDidChange:(NSNotification *)notification if([notification object] == self.tfTrigger) { [[VVDocumenterSetting defaultSetting] setTriggerString:self.tfTrigger.stringValue]; } + if([notification object] == self.tfAuthoInformation) { + [[VVDocumenterSetting defaultSetting] setAuthorInformation:self.tfAuthoInformation.stringValue]; + } + if([notification object] == self.tfDateInformaitonFormat) { + [[VVDocumenterSetting defaultSetting] setDateInformationFormat:self.tfDateInformaitonFormat.stringValue]; + } + if ([notification object] == self.tfSinceVersion) { + [[VVDocumenterSetting defaultSetting] setSinceVersion:self.tfSinceVersion.stringValue]; + } } - (BOOL)control:(NSControl *)control textShouldEndEditing:(NSText *)fieldEditor diff --git a/VVDocumenter-Xcode/Setting/VVDSettingPanelWindowController.xib b/VVDocumenter-Xcode/Setting/VVDSettingPanelWindowController.xib index 29b1cef..cc87211 100644 --- a/VVDocumenter-Xcode/Setting/VVDSettingPanelWindowController.xib +++ b/VVDocumenter-Xcode/Setting/VVDSettingPanelWindowController.xib @@ -1,1312 +1,318 @@ - - - - 1080 - 13E28 - 5056 - 1265.21 - 698.00 - - com.apple.InterfaceBuilder.CocoaPlugin - 5056 - - - NSBox - NSButton - NSButtonCell - NSCustomObject - NSMatrix - NSStepper - NSStepperCell - NSTextField - NSTextFieldCell - NSView - NSWindowTemplate - - - com.apple.InterfaceBuilder.CocoaPlugin - - - PluginDependencyRecalculationVersion - - - - - VVDSettingPanelWindowController - - - FirstResponder - - - NSApplication - - - 3 - 2 - {{508, 391}, {460, 437}} - 544735232 - VVDocumenter Setting - NSWindow - - - - - 256 - - - - 268 - {{67, 311}, {212, 35}} - - - - _NS:9 - YES - - -2080374784 - 268435456 - Use spaces instead of tabs - - .LucidaGrandeUI - 13 - 1044 - - _NS:9 - - 1211912448 - 2 - - NSImage - NSSwitch - - - NSSwitch - - - - 200 - 25 - - NO - - - - 268 - {{329, 320}, {60, 17}} - - - - _NS:1535 - YES - - 68157504 - 272630784 - spaces - - _NS:1535 - - - 6 - System - controlColor - - 3 - MC42NjY2NjY2NjY3AA - - - - 6 - System - controlTextColor - - 3 - MAA - - - - NO - 1 - - - - 268 - {{279, 317}, {37, 22}} - - - - _NS:9 - YES - - -2075131840 - 138417152 - 123 - - _NS:9 - - YES - - 6 - System - textBackgroundColor - - 3 - MQA - - - - 6 - System - textColor - - - - NO - 1 - - - - 268 - {{14, 13}, {113, 32}} - - - - _NS:9 - YES - - 67108864 - 134217728 - Reset Default - - _NS:9 - - -2038284288 - 129 - - - 200 - 25 - - NO - - - - 268 - {{66, 398}, {107, 17}} - - - - _NS:1535 - YES - - 68157504 - 272630784 - Trigger Input - - _NS:1535 - - - - - NO - 1 - - - - 268 - {{279, 395}, {96, 22}} - - - - _NS:9 - YES - - -1804599231 - 71304192 - - - _NS:9 - - YES - - - - NO - 1 - - - - 268 - {{78, 352}, {295, 38}} - - - - _NS:1535 - YES - - 67108864 - 272629760 - VVDocumenter will inspect the input and insert document comment when it matches this. - - LucidaGrande - 12 - 16 - - _NS:1535 - - YES - - - 6 - System - controlShadowColor - - 3 - MC4zMzMzMzMzMzMzAA - - - - NO - 1 - - - - 268 - {{312, 314}, {19, 27}} - - - - _NS:1099 - YES - - 786464 - 0 - _NS:1099 - - 100 - 1 - YES - - NO - - - - 268 - {{67, 290}, {201, 18}} - - - - _NS:9 - YES - - 67108864 - 268435456 - Use @since to all comments - - _NS:9 - - 1211912448 - 2 - - - - - 200 - 25 - - NO - - - - 268 - {{67, 260}, {187, 18}} - - - - _NS:9 - YES - - 67108864 - 268435456 - Use @brief for description - - _NS:9 - - 1211912448 - 2 - - - - - 200 - 25 - - NO - - - - 268 - {{67, 230}, {272, 18}} - - - - _NS:9 - YES - - 67108864 - 268435456 - Use /*! (HeaderDoc style) instead of /** - - _NS:9 - - 1211912448 - 2 - - - - - 200 - 25 - - NO - - - - 268 - {{67, 202}, {272, 18}} - - - - _NS:9 - YES - - -2080374784 - 268435456 - Add blank lines between sections - - _NS:9 - - 1211912448 - 2 - - - - - 200 - 25 - - NO - - - - 268 - {{68, 61}, {325, 85}} - - - - _NS:9 - YES - NO - 3 - 1 - - - 67108864 - 0 - Prefix each comment line with whitespace only - - - 1 - 1211912448 - 0 - - NSRadioButton - - - - 200 - 25 - - - -2080374784 - 0 - Prefix each comment line with a star - - - 2 - 1211912448 - 0 - - 549453824 - {18, 18} - - - - - - TU0AKgAABRgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAADwRERGLJycnySsrK/A1NTXw -IyMjyRwcHIsJCQk8AAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFFRUVdVBQUOCoqKj/ -29vb//n5+f/6+vr/2tra/6qqqv9UVFTgHx8fdQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUZGRl5 -dXV198PDw//8/Pz////////////////////////////U1NT/fHx89yUlJXkAAAAFAAAAAAAAAAAAAAAA -AAAAAxEREUZqamrmtbW1/+3t7f/+/v7//v7+//7+/v/9/f3//f39//39/f/39/f/xMTE/3d3d+YZGRlG -AAAAAwAAAAAAAAAAAAAACkJCQqGtra3/xsbG/+vr6//y8vL/9fX1//X19f/z8/P/9fX1//Ly8v/u7u7/ -0tLS/6+vr/9KSkqhAAAACgAAAAAAAAAAAAAAF3h4eN2/v7//z8/P/93d3f/q6ur/7+/v/+/v7//w8PD/ -7e3t/+3t7f/i4uL/zs7O/8XFxf98fHzdAAAAFwAAAAAAAAADAAAAJKSkpPjOzs7/2dnZ/+Dg4P/i4uL/ -5eXl/+bm5v/n5+f/5eXl/+Li4v/e3t7/2tra/9DQ0P+srKz4AAAAJAAAAAMAAAADAAAALrCwsPrW1tb/ -3t7e/+Tk5P/p6en/6+vr/+zs7P/p6en/6+vr/+fn5//k5OT/4ODg/9nZ2f+zs7P6AAAALgAAAAMAAAAD -AAAALp2dnezg4OD/5eXl/+rq6v/u7u7/8PDw//Dw8P/x8fH/8PDw/+7u7v/q6ur/5ubm/+Hh4f+ZmZns -AAAALgAAAAMAAAADAAAAJG5ubs/l5eX/6enp/+/v7//y8vL/9vb2//r6+v/5+fn/9/f3//b29v/x8fH/ -6+vr/+Tk5P9ra2vPAAAAJAAAAAMAAAAAAAAAFy4uLpPCwsL67Ozs//Pz8//5+fn//v7+//7+/v/+/v7/ -/v7+//v7+//19fX/8PDw/8LCwvosLCyTAAAAFwAAAAAAAAAAAAAACgAAAENfX1/S5OTk/vn5+f/+/v7/ -///////////////////////////8/Pz/5ubm/l9fX9IAAABDAAAACgAAAAAAAAAAAAAAAwAAABcAAABl -YmJi3NLS0v3////////////////////////////////V1dX9ZGRk3AAAAGUAAAAXAAAAAwAAAAAAAAAA -AAAAAAAAAAUAAAAfAAAAZTMzM8KAgIDwv7+//O3t7f/t7e3/v7+//ICAgPAzMzPCAAAAZQAAAB8AAAAF -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAFwAAAEMAAAB3AAAAnwAAALMAAACzAAAAnwAAAHcAAABD -AAAAFwAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAoAAAAXAAAAJAAAAC4AAAAu -AAAAJAAAABcAAAAKAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAwAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgEAAAMAAAABABIAAAEB -AAMAAAABABIAAAECAAMAAAAEAAAFxgEDAAMAAAABAAEAAAEGAAMAAAABAAIAAAERAAQAAAABAAAACAES -AAMAAAABAAEAAAEVAAMAAAABAAQAAAEWAAMAAAABABIAAAEXAAQAAAABAAAFEAEcAAMAAAABAAEAAAFS -AAMAAAABAAEAAAFTAAMAAAAEAAAFzodzAAcAAAxIAAAF1gAAAAAACAAIAAgACAABAAEAAQABAAAMSExp -bm8CEAAAbW50clJHQiBYWVogB84AAgAJAAYAMQAAYWNzcE1TRlQAAAAASUVDIHNSR0IAAAAAAAAAAAAA -AAAAAPbWAAEAAAAA0y1IUCAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAARY3BydAAAAVAAAAAzZGVzYwAAAYQAAABsd3RwdAAAAfAAAAAUYmtwdAAAAgQAAAAUclhZWgAA -AhgAAAAUZ1hZWgAAAiwAAAAUYlhZWgAAAkAAAAAUZG1uZAAAAlQAAABwZG1kZAAAAsQAAACIdnVlZAAA -A0wAAACGdmlldwAAA9QAAAAkbHVtaQAAA/gAAAAUbWVhcwAABAwAAAAkdGVjaAAABDAAAAAMclRSQwAA -BDwAAAgMZ1RSQwAABDwAAAgMYlRSQwAABDwAAAgMdGV4dAAAAABDb3B5cmlnaHQgKGMpIDE5OTggSGV3 -bGV0dC1QYWNrYXJkIENvbXBhbnkAAGRlc2MAAAAAAAAAEnNSR0IgSUVDNjE5NjYtMi4xAAAAAAAAAAAA -AAASc1JHQiBJRUM2MTk2Ni0yLjEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAFhZWiAAAAAAAADzUQABAAAAARbMWFlaIAAAAAAAAAAAAAAAAAAAAABYWVogAAAAAAAA -b6IAADj1AAADkFhZWiAAAAAAAABimQAAt4UAABjaWFlaIAAAAAAAACSgAAAPhAAAts9kZXNjAAAAAAAA -ABZJRUMgaHR0cDovL3d3dy5pZWMuY2gAAAAAAAAAAAAAABZJRUMgaHR0cDovL3d3dy5pZWMuY2gAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAZGVzYwAAAAAAAAAuSUVDIDYx -OTY2LTIuMSBEZWZhdWx0IFJHQiBjb2xvdXIgc3BhY2UgLSBzUkdCAAAAAAAAAAAAAAAuSUVDIDYxOTY2 -LTIuMSBEZWZhdWx0IFJHQiBjb2xvdXIgc3BhY2UgLSBzUkdCAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGRl -c2MAAAAAAAAALFJlZmVyZW5jZSBWaWV3aW5nIENvbmRpdGlvbiBpbiBJRUM2MTk2Ni0yLjEAAAAAAAAA -AAAAACxSZWZlcmVuY2UgVmlld2luZyBDb25kaXRpb24gaW4gSUVDNjE5NjYtMi4xAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAB2aWV3AAAAAAATpP4AFF8uABDPFAAD7cwABBMLAANcngAAAAFYWVogAAAAAABM -CVYAUAAAAFcf521lYXMAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAKPAAAAAnNpZyAAAAAAQ1JUIGN1 -cnYAAAAAAAAEAAAAAAUACgAPABQAGQAeACMAKAAtADIANwA7AEAARQBKAE8AVABZAF4AYwBoAG0AcgB3 -AHwAgQCGAIsAkACVAJoAnwCkAKkArgCyALcAvADBAMYAywDQANUA2wDgAOUA6wDwAPYA+wEBAQcBDQET -ARkBHwElASsBMgE4AT4BRQFMAVIBWQFgAWcBbgF1AXwBgwGLAZIBmgGhAakBsQG5AcEByQHRAdkB4QHp -AfIB+gIDAgwCFAIdAiYCLwI4AkECSwJUAl0CZwJxAnoChAKOApgCogKsArYCwQLLAtUC4ALrAvUDAAML -AxYDIQMtAzgDQwNPA1oDZgNyA34DigOWA6IDrgO6A8cD0wPgA+wD+QQGBBMEIAQtBDsESARVBGMEcQR+ -BIwEmgSoBLYExATTBOEE8AT+BQ0FHAUrBToFSQVYBWcFdwWGBZYFpgW1BcUF1QXlBfYGBgYWBicGNwZI -BlkGagZ7BowGnQavBsAG0QbjBvUHBwcZBysHPQdPB2EHdAeGB5kHrAe/B9IH5Qf4CAsIHwgyCEYIWghu -CIIIlgiqCL4I0gjnCPsJEAklCToJTwlkCXkJjwmkCboJzwnlCfsKEQonCj0KVApqCoEKmAquCsUK3Arz -CwsLIgs5C1ELaQuAC5gLsAvIC+EL+QwSDCoMQwxcDHUMjgynDMAM2QzzDQ0NJg1ADVoNdA2ODakNww3e -DfgOEw4uDkkOZA5/DpsOtg7SDu4PCQ8lD0EPXg96D5YPsw/PD+wQCRAmEEMQYRB+EJsQuRDXEPURExEx -EU8RbRGMEaoRyRHoEgcSJhJFEmQShBKjEsMS4xMDEyMTQxNjE4MTpBPFE+UUBhQnFEkUahSLFK0UzhTw -FRIVNBVWFXgVmxW9FeAWAxYmFkkWbBaPFrIW1hb6Fx0XQRdlF4kXrhfSF/cYGxhAGGUYihivGNUY+hkg -GUUZaxmRGbcZ3RoEGioaURp3Gp4axRrsGxQbOxtjG4obshvaHAIcKhxSHHscoxzMHPUdHh1HHXAdmR3D -HeweFh5AHmoelB6+HukfEx8+H2kflB+/H+ogFSBBIGwgmCDEIPAhHCFIIXUhoSHOIfsiJyJVIoIiryLd -IwojOCNmI5QjwiPwJB8kTSR8JKsk2iUJJTglaCWXJccl9yYnJlcmhya3JugnGCdJJ3onqyfcKA0oPyhx -KKIo1CkGKTgpaymdKdAqAio1KmgqmyrPKwIrNitpK50r0SwFLDksbiyiLNctDC1BLXYtqy3hLhYuTC6C -Lrcu7i8kL1ovkS/HL/4wNTBsMKQw2zESMUoxgjG6MfIyKjJjMpsy1DMNM0YzfzO4M/E0KzRlNJ402DUT -NU01hzXCNf02NzZyNq426TckN2A3nDfXOBQ4UDiMOMg5BTlCOX85vDn5OjY6dDqyOu87LTtrO6o76Dwn -PGU8pDzjPSI9YT2hPeA+ID5gPqA+4D8hP2E/oj/iQCNAZECmQOdBKUFqQaxB7kIwQnJCtUL3QzpDfUPA -RANER0SKRM5FEkVVRZpF3kYiRmdGq0bwRzVHe0fASAVIS0iRSNdJHUljSalJ8Eo3Sn1KxEsMS1NLmkvi -TCpMcky6TQJNSk2TTdxOJU5uTrdPAE9JT5NP3VAnUHFQu1EGUVBRm1HmUjFSfFLHUxNTX1OqU/ZUQlSP -VNtVKFV1VcJWD1ZcVqlW91dEV5JX4FgvWH1Yy1kaWWlZuFoHWlZaplr1W0VblVvlXDVchlzWXSddeF3J -XhpebF69Xw9fYV+zYAVgV2CqYPxhT2GiYfViSWKcYvBjQ2OXY+tkQGSUZOllPWWSZedmPWaSZuhnPWeT -Z+loP2iWaOxpQ2maafFqSGqfavdrT2una/9sV2yvbQhtYG25bhJua27Ebx5veG/RcCtwhnDgcTpxlXHw -cktypnMBc11zuHQUdHB0zHUodYV14XY+dpt2+HdWd7N4EXhueMx5KnmJeed6RnqlewR7Y3vCfCF8gXzh -fUF9oX4BfmJ+wn8jf4R/5YBHgKiBCoFrgc2CMIKSgvSDV4O6hB2EgITjhUeFq4YOhnKG14c7h5+IBIhp -iM6JM4mZif6KZIrKizCLlov8jGOMyo0xjZiN/45mjs6PNo+ekAaQbpDWkT+RqJIRknqS45NNk7aUIJSK -lPSVX5XJljSWn5cKl3WX4JhMmLiZJJmQmfyaaJrVm0Kbr5wcnImc951kndKeQJ6unx2fi5/6oGmg2KFH -obaiJqKWowajdqPmpFakx6U4pammGqaLpv2nbqfgqFKoxKk3qamqHKqPqwKrdavprFys0K1ErbiuLa6h -rxavi7AAsHWw6rFgsdayS7LCszizrrQltJy1E7WKtgG2ebbwt2i34LhZuNG5SrnCuju6tbsuu6e8Ibyb -vRW9j74KvoS+/796v/XAcMDswWfB48JfwtvDWMPUxFHEzsVLxcjGRsbDx0HHv8g9yLzJOsm5yjjKt8s2 -y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2 -2vvbgNwF3IrdEN2W3hzeot8p36/gNuC94UThzOJT4tvjY+Pr5HPk/OWE5g3mlucf56noMui86Ubp0Opb -6uXrcOv77IbtEe2c7ijutO9A78zwWPDl8XLx//KM8xnzp/Q09ML1UPXe9m32+/eK+Bn4qPk4+cf6V/rn -+3f8B/yY/Sn9uv5L/tz/bf//A - - - - - - 3 - MCAwAA - - - - 400 - 75 - - - 67108864 - 0 - Prefix each comment line with three slashes - - - 3 - 1211912448 - 2 - - - 200 - 25 - - - {325, 28} - {4, 2} - 1143480320 - NSActionCell - - 67108864 - 0 - Prefix each comment line with three slashes - - _NS:9 - 1211912448 - 2 - - NSImage - NSRadioButton - - - - - 200 - 25 - - 1 - - - - - - - - 12 - {{70, 152}, {323, 5}} - - - - _NS:9 - {0, 0} - - 67108864 - 0 - Box - - - - 3 - MCAwLjgwMDAwMDAxMTkAA - - - 3 - 2 - 0 - NO - - - - 268 - {{67, 170}, {272, 18}} - - - - _NS:9 - YES - - -2080374784 - 268435456 - Align argument comments - - _NS:9 - - 1211912448 - 2 - - - - - 200 - 25 - - NO - - - {460, 437} - - - - - {{0, 0}, {1680, 1028}} - {10000000000000, 10000000000000} - YES - - - - NO - - - - window - - - - 3 - - - - btnResetPressed: - - - - 33 - - - - tfTrigger - - - - 36 - - - - btnUseSpaces - - - - 37 - - - - tfSpaceCount - - - - 38 - - - - btnUseSpacesPressed: - - - - 51 - - - - tfSpaceLabel - - - - 53 - - - - stepperCount - - - - 57 - - - - stepperPressed: - - - - 58 - - - - btnAddSinceToComment - - - - 1ef-Mr-TVa - - - - btnAddSinceToCommentsPressed: - - - - mx1-gQ-vXj - - - - btnUseHeaderDoc - - - - wor-rz-Ijg - - - - useHeaderDoc: - - - - 1Wy-E1-jLv - - - - btnPrefixWithSlashes - - - - GJD-9u-PLJ - - - - btnPrefixWithStar - - - - JBV-hz-QfR - - - - btnPrefixWithWhitespace - - - - oIB-Va-SeQ - - - - mtxPrefixOptions - - - - pMl-hs-b8d - - - - mtxPrefixSettingPressed: - - - - lCp-Ch-TTG - - - - blankLinesBetweenSections: - - - - Ut9-U7-XdV - - - - btnBlankLinesBetweenSections - - - - vCY-7n-Xqh - - - - alignArgumentComments: - - - - o62-1G-Tta - - - - btnAlightArgumentComments - - - - l9g-ge-CwY - - - - btnBriefDescriptionPressed: - - - - UE3-ix-FCS - - - - btnBriefDescription - - - - oHc-uk-ERk - - - - delegate - - - - 4 - - - - - - 0 - - - - - - -2 - - - File's Owner - - - -1 - - - First Responder - - - -3 - - - Application - - - 1 - - - - - - - - 2 - - - - - - - - - - - - - - - - - - - - - - 9 - - - - - - - - 10 - - - - - 16 - - - - - - - - 17 - - - - - 22 - - - - - - - - 23 - - - - - 24 - - - - - - - - 25 - - - - - 26 - - - - - - - - 27 - - - - - 28 - - - - - - - - 29 - - - - - 30 - - - - - - - - 31 - - - - - - 54 - - - - - - - - 55 - - - - - ERW-1g-i3X - - - - - - - - eH9-9F-VR9 - - - - - bgb-aQ-BAa - - - - - - - - C3y-LS-75k - - - - - 9MP-VX-rsW - - - - - - - - - - - mxJ-X3-ycD - - - - - vMT-lx-3Ep - - - - - wZv-eZ-WK7 - - - - - IVu-o3-DBW - - - - - Qwl-tK-TKG - - - - - 6ax-Nw-Bq5 - - - - - - - - YoT-Nd-Bhd - - - - - g3M-cK-u5v - - - - - - - - 5tp-ni-55q - - - - - gfy-6Z-t8f - - - - - - - - wKY-lg-WfF - - - - - - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - - com.apple.InterfaceBuilder.CocoaPlugin - {{357, 418}, {480, 270}} - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - - - - - - - - - VVDSettingPanelWindowController - NSWindowController - - id - id - id - id - id - id - id - id - id - - - - alignArgumentComments: - id - - - blankLinesBetweenSections: - id - - - btnAddSinceToCommentsPressed: - id - - - btnBriefDescriptionPressed: - id - - - btnResetPressed: - id - - - btnUseSpacesPressed: - id - - - mtxPrefixSettingPressed: - id - - - stepperPressed: - id - - - useHeaderDoc: - id - - - - NSButton - NSButton - NSButton - NSButton - NSButtonCell - NSButtonCell - NSButtonCell - NSButton - NSButton - NSMatrix - NSStepper - NSTextField - NSTextField - NSTextField - - - - btnAddSinceToComment - NSButton - - - btnAlightArgumentComments - NSButton - - - btnBlankLinesBetweenSections - NSButton - - - btnBriefDescription - NSButton - - - btnPrefixWithSlashes - NSButtonCell - - - btnPrefixWithStar - NSButtonCell - - - btnPrefixWithWhitespace - NSButtonCell - - - btnUseHeaderDoc - NSButton - - - btnUseSpaces - NSButton - - - mtxPrefixOptions - NSMatrix - - - stepperCount - NSStepper - - - tfSpaceCount - NSTextField - - - tfSpaceLabel - NSTextField - - - tfTrigger - NSTextField - - - - IBProjectSource - ./Classes/VVDSettingPanelWindowController.h - - - - - 0 - IBCocoaFramework - YES - - com.apple.InterfaceBuilder.CocoaPlugin.macosx - - - - com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 - - - YES - 3 - - {16, 15} - {15, 15} - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/VVDocumenter-Xcode/Setting/VVDocumenterSetting.h b/VVDocumenter-Xcode/Setting/VVDocumenterSetting.h index 636388c..77ae120 100644 --- a/VVDocumenter-Xcode/Setting/VVDocumenterSetting.h +++ b/VVDocumenter-Xcode/Setting/VVDocumenterSetting.h @@ -3,26 +3,58 @@ // VVDocumenter-Xcode // // Created by 王 巍 on 13-8-3. -// Copyright (c) 2013年 OneV's Den. All rights reserved. // +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. #import +typedef NS_ENUM(NSInteger, VVDSinceOption) { + VVDSinceOptionPlaceholder, + VVDSinceOptionProjectVersion, + VVDSinceOptionSpecificVersion, +}; + extern NSString *const VVDDefaultTriggerString; +extern NSString *const VVDDefaultAuthorString; +extern NSString *const VVDDefaultDateInfomationFormat; @interface VVDocumenterSetting : NSObject + (VVDocumenterSetting *)defaultSetting; -@property (readonly) BOOL useDvorakLayout; +@property (readonly) NSInteger keyVCode; @property BOOL useSpaces; @property NSInteger spaceCount; @property NSString *triggerString; +@property VVDSinceOption sinceOption; @property BOOL prefixWithStar; @property BOOL prefixWithSlashes; @property BOOL addSinceToComments; +@property NSString *sinceVersion; @property BOOL briefDescription; @property BOOL useHeaderDoc; @property BOOL blankLinesBetweenSections; @property BOOL alignArgumentComments; +@property BOOL useAuthorInformation; +@property NSString *authorInformation; +@property BOOL useDateInformation; +@property NSString *dateInformationFormat; @property (readonly) NSString *spacesString; @end diff --git a/VVDocumenter-Xcode/Setting/VVDocumenterSetting.m b/VVDocumenter-Xcode/Setting/VVDocumenterSetting.m index 11b0bc1..ce69b91 100644 --- a/VVDocumenter-Xcode/Setting/VVDocumenterSetting.m +++ b/VVDocumenter-Xcode/Setting/VVDocumenterSetting.m @@ -3,13 +3,34 @@ // VVDocumenter-Xcode // // Created by 王 巍 on 13-8-3. -// Copyright (c) 2013年 OneV's Den. All rights reserved. // +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. #import "VVDocumenterSetting.h" #import +#import "VVProject.h" NSString *const VVDDefaultTriggerString = @"///"; +NSString *const VVDDefaultAuthorString = @""; +NSString *const VVDDefaultDateInfomationFormat = @"YY-MM-dd HH:MM:ss"; NSString *const kVVDUseSpaces = @"com.onevcat.VVDocumenter.useSpaces"; NSString *const kVVDSpaceCount = @"com.onevcat.VVDocumenter.spaceCount"; @@ -17,10 +38,16 @@ NSString *const kVVDPrefixWithStar = @"com.onevcat.VVDocumenter.prefixWithStar"; NSString *const kVVDPrefixWithSlashes = @"com.onevcat.VVDocumenter.prefixWithSlashes"; NSString *const kVVDAddSinceToComments = @"com.onevcat.VVDocumenter.addSinceToComments"; +NSString *const kVVDSinceVersion = @"com.onevcat.VVDocumenter.sinceVersion"; +NSString *const kVVDSinceOption = @"com.onevcat.VVDocumenter.sinceOption"; NSString *const kVVDBriefDescription = @"com.onevcat.VVDocumenter.briefDescription"; NSString *const kVVDUserHeaderDoc = @"com.onevcat.VVDocumenter.useHeaderDoc"; NSString *const kVVDNoBlankLinesBetweenFields = @"com.onevcat.VVDocumenter.noBlankLinesBetweenFields"; NSString *const kVVDNoArgumentPadding = @"com.onevcat.VVDocumenter.noArgumentPadding"; +NSString *const kVVDUseAuthorInformation = @"com.onevcat.VVDocumenter.useAuthorInformation"; +NSString *const kVVDAuthorInfomation = @"com.onevcat.VVDocumenter.authorInfomation"; +NSString *const kVVDUseDateInformation = @"com.onevcat.VVDocumenter.useDateInformation"; +NSString *const kVVDDateInformationFormat = @"com.onevcat.VVDocumenter.dateInformationFomat"; @implementation VVDocumenterSetting + (VVDocumenterSetting *)defaultSetting @@ -48,19 +75,36 @@ -(void) setUseSpaces:(BOOL)useSpace [[NSUserDefaults standardUserDefaults] synchronize]; } --(BOOL) useDvorakLayout +-(NSInteger) keyVCode { TISInputSourceRef inputSource = TISCopyCurrentKeyboardLayoutInputSource(); NSString *layoutID = (__bridge NSString *)TISGetInputSourceProperty(inputSource, kTISPropertyInputSourceID); CFRelease(inputSource); - - if ([layoutID rangeOfString:@"Dvorak" options:NSCaseInsensitiveSearch].location != NSNotFound) { - return YES; - } else { - return NO; + + // Possible dvorak layout SourceIDs: + // com.apple.keylayout.Dvorak (System Qwerty) + // But exclude: + // com.apple.keylayout.DVORAK-QWERTYCMD (System Qwerty ⌘) + // org.unknown.keylayout.DvorakImproved-Qwerty⌘ (http://www.macupdate.com/app/mac/24137/dvorak-improved-keyboard-layout) + if ([layoutID localizedCaseInsensitiveContainsString:@"dvorak"] && ![layoutID localizedCaseInsensitiveContainsString: @"qwerty"]) { + return kVK_ANSI_Period; } + + // Possible workman layout SourceIDs (https://github.com/ojbucao/Workman): + // org.sil.ukelele.keyboardlayout.workman.workman + // org.sil.ukelele.keyboardlayout.workman.workmanextended + // org.sil.ukelele.keyboardlayout.workman.workman-io + // org.sil.ukelele.keyboardlayout.workman.workman-p + // org.sil.ukelele.keyboardlayout.workman.workman-pextended + // org.sil.ukelele.keyboardlayout.workman.workman-dead + if ([layoutID localizedCaseInsensitiveContainsString:@"workman"]) { + return kVK_ANSI_B; + } + + return kVK_ANSI_V; } + -(NSInteger) spaceCount { NSInteger count = [[NSUserDefaults standardUserDefaults] integerForKey:kVVDSpaceCount]; @@ -99,6 +143,17 @@ -(void) setTriggerString:(NSString *)triggerString [[NSUserDefaults standardUserDefaults] synchronize]; } +-(VVDSinceOption) sinceOption +{ + return (VVDSinceOption)[[NSUserDefaults standardUserDefaults] integerForKey:kVVDSinceOption]; +} + +- (void)setSinceOption:(VVDSinceOption)sinceOption +{ + [[NSUserDefaults standardUserDefaults] setInteger:sinceOption forKey:kVVDSinceOption]; + [[NSUserDefaults standardUserDefaults] synchronize]; +} + -(BOOL) prefixWithStar { return [[NSUserDefaults standardUserDefaults] boolForKey:kVVDPrefixWithStar]; @@ -132,6 +187,23 @@ -(void) setAddSinceToComments:(BOOL)add [[NSUserDefaults standardUserDefaults] synchronize]; } +- (NSString *)sinceVersion +{ + NSString *sinceVersion = [[NSUserDefaults standardUserDefaults] objectForKey:kVVDSinceVersion]; + + if ( ! sinceVersion ) { + sinceVersion = @""; + } + + return sinceVersion; +} + +- (void)setSinceVersion:(NSString *)sinceVersion +{ + [[NSUserDefaults standardUserDefaults] setObject:sinceVersion forKey:kVVDSinceVersion]; + [[NSUserDefaults standardUserDefaults] synchronize]; +} + -(BOOL) briefDescription { return [[NSUserDefaults standardUserDefaults] boolForKey:kVVDBriefDescription]; @@ -173,6 +245,60 @@ -(void) setAlignArgumentComments:(BOOL)alignArgumentComments [[NSUserDefaults standardUserDefaults] synchronize]; } +-(BOOL)useAuthorInformation +{ + return [[NSUserDefaults standardUserDefaults] boolForKey:kVVDUseAuthorInformation]; +} +-(void) setUseAuthorInformation:(BOOL)useAuthorInformation +{ + [[NSUserDefaults standardUserDefaults] setBool:useAuthorInformation forKey:kVVDUseAuthorInformation]; + [[NSUserDefaults standardUserDefaults] synchronize]; +} + +-(NSString *)authorInformation { + NSString *authorInformation = [[NSUserDefaults standardUserDefaults] objectForKey:kVVDAuthorInfomation]; + if (authorInformation.length <= 0 ) { + NSString *name = [[VVProject projectForKeyWindow] organizeationName]; + if (name.length <= 0) { + NSDictionary *environment = [[NSProcessInfo processInfo] environment]; + name = [environment objectForKey:@"LOGNAME"]; + } + + if (name.length > 0) { + authorInformation = name; + }else{ + authorInformation = VVDDefaultAuthorString; + } + } + return authorInformation; +} +-(void)setAuthorInformation:(NSString *)authorInformation { + [[NSUserDefaults standardUserDefaults] setObject:authorInformation forKey:kVVDAuthorInfomation]; + [[NSUserDefaults standardUserDefaults] synchronize]; +} + +-(BOOL)useDateInformation +{ + return [[NSUserDefaults standardUserDefaults] boolForKey:kVVDUseDateInformation]; +} +-(void) setUseDateInformation:(BOOL)useDateInformation +{ + [[NSUserDefaults standardUserDefaults] setBool:useDateInformation forKey:kVVDUseDateInformation]; + [[NSUserDefaults standardUserDefaults] synchronize]; +} + +-(NSString *)dateInformationFormat { + NSString *formatString = [[NSUserDefaults standardUserDefaults] objectForKey:kVVDDateInformationFormat]; + if (formatString == nil || formatString.length <= 0) { + formatString = VVDDefaultDateInfomationFormat; + } + return formatString; +} +-(void)setDateInformationFormat:(NSString *)dateInformationFormat { + [[NSUserDefaults standardUserDefaults] setObject:dateInformationFormat forKey:kVVDDateInformationFormat]; + [[NSUserDefaults standardUserDefaults] synchronize]; +} + -(NSString *) spacesString { if ([self useSpaces]) { diff --git a/VVDocumenter-Xcode/VVDocumenter-Xcode-Info.plist b/VVDocumenter-Xcode/VVDocumenter-Xcode-Info.plist index f80895c..17e006d 100644 --- a/VVDocumenter-Xcode/VVDocumenter-Xcode-Info.plist +++ b/VVDocumenter-Xcode/VVDocumenter-Xcode-Info.plist @@ -9,7 +9,7 @@ CFBundleIconFile CFBundleIdentifier - com.onevcat.${PRODUCT_NAME:rfc1034identifier} + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName @@ -24,11 +24,29 @@ 1 DVTPlugInCompatibilityUUIDs + 9AFF134A-08DC-4096-8CEE-62A4BB123046 63FC1C47-140D-42B0-BB4D-A10B2D225574 37B30044-3B14-46BA-ABAA-F01000C27B63 640F884E-CE55-4B40-87C0-8869546CAB7A A2E4D43F-41F4-4FB9-BB94-7177011C9AED AD68E85B-441B-4301-B564-A45E4919A6AD + C4A681B0-4A26-480E-93EC-1218098B9AA0 + FEC992CC-CA4A-4CFD-8881-77300FCB848A + 992275C1-432A-4CF7-B659-D84ED6D42D3F + A16FF353-8441-459E-A50C-B071F53F51B7 + 9F75337B-21B4-4ADC-B558-F9CADF7073A7 + 992275C1-432A-4CF7-B659-D84ED6D42D3F + 8DC44374-2B35-4C57-A6FE-2AD66A36AAD9 + E969541F-E6F9-4D25-8158-72DC3545A6C6 + AABB7188-E14E-4433-AD3B-5CD791EAD9A3 + 7FDF5C7A-131F-4ABB-9EDC-8C5F8F0B8A90 + 0420B86A-AA43-4792-9ED0-6FE0F2B16A13 + CC0D0F4F-05B3-431A-8F33-F84AFCB2C651 + 7265231C-39B4-402C-89E1-16167C4CC990 + F41BD31E-2683-44B8-AE7F-5F09E919790E + E71C2CFE-BFD8-4044-8F06-00AE685A406C + ACA8656B-FEA8-4B6D-8E4A-93F4C95C362C + E0A62D1F-3C18-4D74-BFE5-A4167D643966 NSHumanReadableCopyright Copyright © 2013年 OneV's Den. All rights reserved. diff --git a/VVDocumenter-Xcode/VVDocumenter.h b/VVDocumenter-Xcode/VVDocumenter.h index 8844499..5c498a7 100644 --- a/VVDocumenter-Xcode/VVDocumenter.h +++ b/VVDocumenter-Xcode/VVDocumenter.h @@ -3,8 +3,26 @@ // VVDocumenter-Xcode // // Created by 王 巍 on 13-7-17. -// Copyright (c) 2013年 OneV's Den. All rights reserved. // +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. #import diff --git a/VVDocumenter-Xcode/VVDocumenter.m b/VVDocumenter-Xcode/VVDocumenter.m index eb2eac3..e54c834 100755 --- a/VVDocumenter-Xcode/VVDocumenter.m +++ b/VVDocumenter-Xcode/VVDocumenter.m @@ -3,8 +3,26 @@ // VVDocumenter-Xcode // // Created by 王 巍 on 13-7-17. -// Copyright (c) 2013年 OneV's Den. All rights reserved. // +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. #import "VVDocumenter.h" #import "NSString+VVSyntax.h" @@ -76,6 +94,8 @@ -(NSString *) document commenter = [[VVSwiftFunctionCommenter alloc] initWithIndentString:baseIndent codeString:trimCode]; } else if ([trimCode vv_isSwiftProperty]) { commenter = [[VVSwiftPropertyCommenter alloc] initWithIndentString:baseIndent codeString:trimCode]; + } else if ([trimCode vv_isSwiftExtension]) { + commenter = [[VVSwiftExtensionCommenter alloc] initWithIndentString:baseIndent codeString:trimCode]; } else { commenter = [[VVVariableCommenter alloc] initWithIndentString:baseIndent codeString:trimCode]; } diff --git a/VVDocumenter-Xcode/VVDocumenterManager.h b/VVDocumenter-Xcode/VVDocumenterManager.h index ec44348..ea371f9 100644 --- a/VVDocumenter-Xcode/VVDocumenterManager.h +++ b/VVDocumenter-Xcode/VVDocumenterManager.h @@ -3,8 +3,26 @@ // VVDocumenter-Xcode // // Created by 王 巍 on 13-7-16. -// Copyright (c) 2013年 OneV's Den. All rights reserved. // +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. #import diff --git a/VVDocumenter-Xcode/VVDocumenterManager.m b/VVDocumenter-Xcode/VVDocumenterManager.m index 573a92b..d273b47 100644 --- a/VVDocumenter-Xcode/VVDocumenterManager.m +++ b/VVDocumenter-Xcode/VVDocumenterManager.m @@ -3,8 +3,26 @@ // VVDocumenter-Xcode // // Created by 王 巍 on 13-7-16. -// Copyright (c) 2013年 OneV's Den. All rights reserved. // +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. #import "VVDocumenterManager.h" #import "NSTextView+VVTextGetter.h" @@ -114,6 +132,7 @@ - (void) textStorageDidChange:(NSNotification *)noti { //We just want to document the next valid line. VVTextResult *resultUntilSemiColon = [textView vv_textResultUntilNextString:@";"]; VVTextResult *resultUntilBrace = [textView vv_textResultUntilNextString:@"{"]; + VVTextResult *resultUntilFileEnd = [textView vv_textResultToEndOfFile]; VVTextResult *resultToDocument = nil; @@ -121,8 +140,10 @@ - (void) textStorageDidChange:(NSNotification *)noti { resultToDocument = (resultUntilSemiColon.range.length < resultUntilBrace.range.length) ? resultUntilSemiColon : resultUntilBrace; } else if (resultUntilBrace) { resultToDocument = resultUntilBrace; - } else { + } else if (resultUntilSemiColon) { resultToDocument = resultUntilSemiColon; + } else { + resultToDocument = resultUntilFileEnd; } //We always write document until semicolon for enum. (Maybe struct later) @@ -131,11 +152,14 @@ - (void) textStorageDidChange:(NSNotification *)noti { shouldReplace = YES; } + NSString *inputCode = nil; if ([resultToDocument.string vv_isSwiftEnum]) { - resultToDocument = [textView vv_textResultWithPairOpenString:@"{" closeString:@"}"]; + inputCode = [textView vv_textResultWithPairOpenString:@"{" closeString:@"}"].string; + } else { + inputCode = [resultToDocument.string vv_stringByConvertingToUniform]; } - VVDocumenter *doc = [[VVDocumenter alloc] initWithCode:resultToDocument.string]; + VVDocumenter *doc = [[VVDocumenter alloc] initWithCode:inputCode]; NSString *documentationString = [doc document]; if (!documentationString) { @@ -161,8 +185,8 @@ - (void) textStorageDidChange:(NSNotification *)noti { //Cmd+delete Delete current line [kes sendKeyCode:kVK_Delete withModifierCommand:YES alt:NO shift:NO control:NO]; //if (shouldReplace) [textView setSelectedRange:resultToDocument.range]; - //Cmd+V, paste (If it is Dvorak layout, use '.', which is corresponding the key 'V' in a QWERTY layout) - NSInteger kKeyVCode = [[VVDocumenterSetting defaultSetting] useDvorakLayout] ? kVK_ANSI_Period : kVK_ANSI_V; + //Cmd+V, paste (which key to actually use is based on the current keyboard layout) + NSInteger kKeyVCode = [[VVDocumenterSetting defaultSetting] keyVCode]; [kes sendKeyCode:kKeyVCode withModifierCommand:YES alt:NO shift:NO control:NO]; //The key down is just a defined finish signal by me. When we receive this key, we know operation above is finished. diff --git a/VVDocumenterTests/CommenterTests/CommenterTests.m b/VVDocumenterTests/CommenterTests/CommenterTests.m index c3230f6..35f11ab 100644 --- a/VVDocumenterTests/CommenterTests/CommenterTests.m +++ b/VVDocumenterTests/CommenterTests/CommenterTests.m @@ -3,8 +3,26 @@ // VVDocumenter-Xcode // // Created by 王 巍 on 13-7-20. -// Copyright (c) 2013年 OneV's Den. All rights reserved. // +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. #import #import "VVCommenter.h" diff --git a/VVDocumenterTests/DocumenterTests/VVMethodTestsCode.plist b/VVDocumenterTests/DocumenterTests/VVMethodTestsCode.plist index 4f2c003..f45dbba 100644 --- a/VVDocumenterTests/DocumenterTests/VVMethodTestsCode.plist +++ b/VVDocumenterTests/DocumenterTests/VVMethodTestsCode.plist @@ -51,7 +51,7 @@ source -(void)whenLinked:(void (^)(void))actionHandler uniform - -(void)whenLinked:(void (^)(void))actionHandler + -(void)whenLinked:(void(^)(void))actionHandler result /** * <#Description#> @@ -59,6 +59,31 @@ * @param actionHandler <#actionHandler description#> */ + + source + -(void) writeMediasetJSON: (void (^)(void)) uploadCompletionBlock{} + uniform + -(void)writeMediasetJSON:(void(^)(void))uploadCompletionBlock{} + result + /** + * <#Description#> + * + * @param uploadCompletionBlock <#uploadCompletionBlock description#> + */ + + + source + -(void) createNewMediaset:(NSString *) collectionName withCompletionBlock: (void (^)(void)) completionBlock; + uniform + -(void)createNewMediaset:(NSString *)collectionName withCompletionBlock:(void(^)(void))completionBlock; + result + /** + * <#Description#> + * + * @param collectionName <#collectionName description#> + * @param completionBlock <#completionBlock description#> + */ + vv_isCFunction @@ -192,7 +217,7 @@ source void print2DList(int rowCount, int (*p)[10]); uniform - void print2DList(int rowCount, int (*p)[10]); + void print2DList(int rowCount, int(*p)[10]); result /** * <#Description#> @@ -271,7 +296,7 @@ source #define ABS(A) ((A) < 0 ? (-(A)) : (A)) uniform - #define ABS(A)((A)< 0 ?(-(A)) :(A)) + #define ABS(A)((A)< 0 ?(-(A)):(A)) result /** * <#Description#> @@ -330,7 +355,7 @@ /** * <#Description#> */ -typedef NS_ENUM(NSInteger, SIAlertViewBackgroundStyle){ +typedef NS_ENUM(NSInteger, SIAlertViewBackgroundStyle) { /** * <#Description#> */ @@ -404,6 +429,21 @@ SIAlertViewBackgroundStyleSolid, vv_isSwiftFunction + + source + func testParasType(var a: Int, let b: Int, inout c: Int, d: Int) { + uniform + func testParasType(var a: Int, let b: Int, inout c: Int, d: Int){ + result + /** + <#Description#> + + - parameter a: <#a description#> + - parameter b: <#b description#> + - parameter c: <#c description#> + - parameter d: <#d description#> + */ + source func sayHello(personName: String) -> String { @@ -413,9 +453,9 @@ SIAlertViewBackgroundStyleSolid, /** <#Description#> - :param: personName <#personName description#> + - parameter personName: <#personName description#> - :returns: <#return value description#> + - returns: <#return value description#> */ @@ -427,9 +467,9 @@ SIAlertViewBackgroundStyleSolid, /** <#Description#> - :param: para <#para description#> + - parameter para: <#para description#> - :returns: <#return value description#> + - returns: <#return value description#> */ @@ -441,8 +481,8 @@ SIAlertViewBackgroundStyleSolid, /** <#Description#> - :param: miao <#miao description#> - :param: wu <#wu description#> + - parameter miao: <#miao description#> + - parameter wu: <#wu description#> */ @@ -454,44 +494,162 @@ SIAlertViewBackgroundStyleSolid, /** <#Description#> - :param: style <#style description#> - :param: gearing <#gearing description#> - :param: handlebar <#handlebar description#> - :param: centimeters <#centimeters description#> + - parameter style: <#style description#> + - parameter gearing: <#gearing description#> + - parameter handlebar: <#handlebar description#> + - parameter centimeters: <#centimeters description#> - :returns: <#return value description#> + - returns: <#return value description#> */ source func Test(input : Int, condition : (Int, String) -> Bool = {(t: Int,k: String) in return true}) -> (Int,Int) { uniform - func Test(input : Int, condition : (Int, String)-> Bool = {(t: Int,k: String)in return true}) ->(Int,Int){ + func Test(input : Int, condition :(Int, String)-> Bool = {(t: Int,k: String)in return true})->(Int,Int){ result /** <#Description#> - :param: input <#input description#> - :param: condition <#condition description#> + - parameter input: <#input description#> + - parameter condition: <#condition description#> - :returns: <#return value description#> + - returns: <#return value description#> */ source func URLSession(session: NSURLSession!, task: NSURLSessionTask!, didReceiveChallenge challenge: NSURLAuthenticationChallenge!, completionHandler: ((NSURLSessionAuthChallengeDisposition, NSURLCredential!) -> Void)!) { uniform - func URLSession(session: NSURLSession!, task: NSURLSessionTask!, didReceiveChallenge challenge: NSURLAuthenticationChallenge!, completionHandler: ((NSURLSessionAuthChallengeDisposition, NSURLCredential!)-> Void)!) { + func URLSession(session: NSURLSession!, task: NSURLSessionTask!, didReceiveChallenge challenge: NSURLAuthenticationChallenge!, completionHandler:((NSURLSessionAuthChallengeDisposition, NSURLCredential!)-> Void)!){ + result + /** + <#Description#> + + - parameter session: <#session description#> + - parameter task: <#task description#> + - parameter challenge: <#challenge description#> + - parameter completionHandler: <#completionHandler description#> + */ + + + source + func makeTuple(a:Int, b:Int, c:Int) -> (sum:Int, product:Int, max:Int) { + uniform + func makeTuple(a:Int, b:Int, c:Int)->(sum:Int, product:Int, max:Int){ result /** <#Description#> - :param: session <#session description#> - :param: task <#task description#> - :param: challenge <#challenge description#> - :param: completionHandler <#completionHandler description#> + - parameter a: <#a description#> + - parameter b: <#b description#> + - parameter c: <#c description#> + + - returns: <#return value description#> */ + + source + public subscript (key: KeyType) -> ValueType? { + uniform + public subscript(key: KeyType)-> ValueType? { + result + /** + <#Description#> + + - parameter key: <#key description#> + + - returns: <#return value description#> + */ + + + source + func getSomething(input:String?, success: (Int) -> Void, failure: (NSHTTPURLResponse?, AnyObject?, NSError?) -> Void) { + uniform + func getSomething(input:String?, success:(Int)-> Void, failure:(NSHTTPURLResponse?, AnyObject?, NSError?)-> Void){ + result + /** + <#Description#> + + - parameter input: <#input description#> + - parameter success: <#success description#> + - parameter failure: <#failure description#> + */ + + + source + func methodCouldThrows(count: Int) throws -> Int { + uniform + func methodCouldThrows(count: Int)throws -> Int { + result + /** + <#Description#> + + - parameter count: <#count description#> + + - throws: <#throws value description#> + + - returns: <#return value description#> + */ + + + source + func methodCouldThrows() throws { + uniform + func methodCouldThrows()throws { + result + /** + <#Description#> + + - throws: <#throws value description#> + */ + + + source + func methodCouldThrows(count: Int, name: String, f: (Int, String) throws -> Void) rethrows -> Int { + uniform + func methodCouldThrows(count: Int, name: String, f:(Int, String)throws -> Void)rethrows -> Int { + result + /** + <#Description#> + + - parameter count: <#count description#> + - parameter name: <#name description#> + - parameter f: <#f description#> + + - throws: <#throws value description#> + + - returns: <#return value description#> + */ + + + source + public class func amethod(count: Int) -> Int? { + uniform + public class func amethod(count: Int)-> Int? { + result + /** + <#Description#> + + - parameter count: <#count description#> + + - returns: <#return value description#> + */ + + + source + func testTuple(aTuple: (first: String, second: String, third: String)) -> (first: String, second: String, third: String)? { + uniform + func testTuple(aTuple:(first: String, second: String, third: String))->(first: String, second: String, third: String)? { + result + /** + <#Description#> + + - parameter aTuple: <#aTuple description#> + + - returns: <#return value description#> + */ + vv_isSwiftEnum @@ -595,5 +753,24 @@ SIAlertViewBackgroundStyleSolid, /// <#Description#> + vv_isSwiftExtension + + + source + extension MyClass: SomeDelegate { + uniform + extension MyClass: SomeDelegate { + result + // MARK: - <#SomeDelegate#> + + + source + private extension MyClass\n { + uniform + private extension MyClass\n { + result + // MARK: - <#Description#> + + diff --git a/VVDocumenterTests/SyntaxTests/SyntaxTests.m b/VVDocumenterTests/SyntaxTests/SyntaxTests.m index f6f0de7..7b1ff4c 100755 --- a/VVDocumenterTests/SyntaxTests/SyntaxTests.m +++ b/VVDocumenterTests/SyntaxTests/SyntaxTests.m @@ -3,8 +3,26 @@ // VVDocumenter-Xcode // // Created by 王 巍 on 13-7-19. -// Copyright (c) 2013年 OneV's Den. All rights reserved. // +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. #import #import "VVTestHelper.h" @@ -50,7 +68,7 @@ -(void) testStringByConvertingToUniform { } -(void) testIsObjCMethod { - NSArray *boolResult = @[@YES,@NO,@NO,@NO,@NO,@NO,@NO,@NO,@NO,@NO,@NO,@NO]; + NSArray *boolResult = @[@YES,@NO,@NO,@NO,@NO,@NO,@NO,@NO,@NO,@NO,@NO,@NO,@NO]; for (int i = 0; i < (int)[self.inputs count]; i++) { for (int j = 0; j < [self.inputs[i] count]; j++) { @@ -61,7 +79,7 @@ -(void) testIsObjCMethod { } -(void) testIsCFunction { - NSArray *boolResult = @[@NO,@YES,@NO,@NO,@NO,@NO,@NO,@NO,@NO,@NO,@NO,@NO]; + NSArray *boolResult = @[@NO,@YES,@NO,@NO,@NO,@NO,@NO,@NO,@NO,@NO,@NO,@NO,@NO]; for (int i = 0; i < (int)[self.inputs count]; i++) { for (int j = 0; j < [self.inputs[i] count]; j++) { @@ -72,7 +90,7 @@ -(void) testIsCFunction { } -(void) testIsProperty { - NSArray *boolResult = @[@NO,@NO,@YES,@NO,@NO,@NO,@NO,@NO,@NO,@NO,@NO,@NO]; + NSArray *boolResult = @[@NO,@NO,@YES,@NO,@NO,@NO,@NO,@NO,@NO,@NO,@NO,@NO,@NO]; for (int i = 0; i < (int)[self.inputs count]; i++) { for (int j = 0; j < [self.inputs[i] count]; j++) { @@ -83,7 +101,7 @@ -(void) testIsProperty { } -(void) testIsMacro { - NSArray *boolResult = @[@NO,@NO,@NO,@YES,@NO,@NO,@NO,@NO,@NO,@NO,@NO,@NO]; + NSArray *boolResult = @[@NO,@NO,@NO,@YES,@NO,@NO,@NO,@NO,@NO,@NO,@NO,@NO,@NO]; for (int i = 0; i < (int)[self.inputs count]; i++) { for (int j = 0; j < [self.inputs[i] count]; j++) { @@ -94,7 +112,7 @@ -(void) testIsMacro { } -(void) testIsStruct { - NSArray *boolResult = @[@NO,@NO,@NO,@NO,@YES,@NO,@NO,@NO,@NO,@NO,@NO,@NO]; + NSArray *boolResult = @[@NO,@NO,@NO,@NO,@YES,@NO,@NO,@NO,@NO,@NO,@NO,@NO,@NO]; for (int i = 0; i < (int)[self.inputs count]; i++) { for (int j = 0; j < [self.inputs[i] count]; j++) { @@ -105,7 +123,7 @@ -(void) testIsStruct { } -(void) testIsEnum { - NSArray *boolResult = @[@NO,@NO,@NO,@NO,@NO,@YES,@NO,@NO,@NO,@NO,@NO,@NO]; + NSArray *boolResult = @[@NO,@NO,@NO,@NO,@NO,@YES,@NO,@NO,@NO,@NO,@NO,@NO,@NO]; for (int i = 0; i < (int)[self.inputs count]; i++) { for (int j = 0; j < [self.inputs[i] count]; j++) { @@ -116,7 +134,7 @@ -(void) testIsEnum { } -(void) testIsUnion { - NSArray *boolResult = @[@NO,@NO,@NO,@NO,@NO,@NO,@YES,@NO,@NO,@NO,@NO,@NO]; + NSArray *boolResult = @[@NO,@NO,@NO,@NO,@NO,@NO,@YES,@NO,@NO,@NO,@NO,@NO,@NO]; for (int i = 0; i < (int)[self.inputs count]; i++) { for (int j = 0; j < [self.inputs[i] count]; j++) { @@ -127,7 +145,7 @@ -(void) testIsUnion { } -(void) testIsCompileKeyword { - NSArray *boolResult = @[@NO,@NO,@NO,@NO,@NO,@NO,@NO,@NO,@YES,@NO,@NO,@NO]; + NSArray *boolResult = @[@NO,@NO,@NO,@NO,@NO,@NO,@NO,@NO,@YES,@NO,@NO,@NO,@NO]; for (int i = 0; i < (int)[self.inputs count]; i++) { for (int j = 0; j < [self.inputs[i] count]; j++) { @@ -138,7 +156,7 @@ -(void) testIsCompileKeyword { } -(void) testIsSwiftFunction { - NSArray *boolResult = @[@NO,@NO,@NO,@NO,@NO,@NO,@NO,@NO,@NO,@YES,@NO,@NO]; + NSArray *boolResult = @[@NO,@NO,@NO,@NO,@NO,@NO,@NO,@NO,@NO,@YES,@NO,@NO,@NO]; for (int i = 0; i < (int)[self.inputs count]; i++) { for (int j = 0; j < [self.inputs[i] count]; j++) { @@ -149,7 +167,7 @@ -(void) testIsSwiftFunction { } -(void) testIsSwiftEnum { - NSArray *boolResult = @[@NO,@NO,@NO,@NO,@NO,@NO,@NO,@NO,@NO,@NO,@YES,@NO]; + NSArray *boolResult = @[@NO,@NO,@NO,@NO,@NO,@NO,@NO,@NO,@NO,@NO,@YES,@NO,@NO]; for (int i = 0; i < (int)[self.inputs count]; i++) { for (int j = 0; j < [self.inputs[i] count]; j++) { @@ -160,7 +178,7 @@ -(void) testIsSwiftEnum { } -(void) testIsSwiftProperty { - NSArray *boolResult = @[@NO,@NO,@NO,@NO,@NO,@NO,@NO,@NO,@NO,@NO,@NO,@YES]; + NSArray *boolResult = @[@NO,@NO,@NO,@NO,@NO,@NO,@NO,@NO,@NO,@NO,@NO,@YES,@NO]; for (int i = 0; i < (int)[self.inputs count]; i++) { for (int j = 0; j < [self.inputs[i] count]; j++) { @@ -170,4 +188,15 @@ -(void) testIsSwiftProperty { } } +-(void) testIsSwiftExtension { + NSArray *boolResult = @[@NO,@NO,@NO,@NO,@NO,@NO,@NO,@NO,@NO,@NO,@NO,@NO,@YES]; + + for (int i = 0; i < (int)[self.inputs count]; i++) { + for (int j = 0; j < [self.inputs[i] count]; j++) { + NSString *result = self.corrects[i][j]; + XCTAssertTrue([result vv_isSwiftExtension] == [boolResult[i] boolValue], @"%@ should %@ be a swift extension", result, [boolResult[i] boolValue] ? @"" : @"not"); + } + } +} + @end diff --git a/VVDocumenterTests/VVDocumenterTests-Info.plist b/VVDocumenterTests/VVDocumenterTests-Info.plist index 7d55e65..169b6f7 100644 --- a/VVDocumenterTests/VVDocumenterTests-Info.plist +++ b/VVDocumenterTests/VVDocumenterTests-Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIdentifier - com.onevcat.${PRODUCT_NAME:rfc1034identifier} + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundlePackageType diff --git a/VVDocumenterTests/VVDocumenterTests.m b/VVDocumenterTests/VVDocumenterTests.m index ba7c296..5019b0c 100755 --- a/VVDocumenterTests/VVDocumenterTests.m +++ b/VVDocumenterTests/VVDocumenterTests.m @@ -1,10 +1,28 @@ // // VVDocumenterTests.m -// VVDocumenterTests +// VVDocumenter-Xcode // // Created by 王 巍 on 13-7-19. -// Copyright (c) 2013年 OneV's Den. All rights reserved. // +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. #import #import "VVDocumenter.h" diff --git a/VVDocumenterTests/VVTestHelper.h b/VVDocumenterTests/VVTestHelper.h index b11b4ed..c5a4bf5 100755 --- a/VVDocumenterTests/VVTestHelper.h +++ b/VVDocumenterTests/VVTestHelper.h @@ -3,8 +3,26 @@ // VVDocumenter-Xcode // // Created by 王 巍 on 13-7-19. -// Copyright (c) 2013年 OneV's Den. All rights reserved. // +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. #import diff --git a/VVDocumenterTests/VVTestHelper.m b/VVDocumenterTests/VVTestHelper.m index e17f985..5212ee6 100755 --- a/VVDocumenterTests/VVTestHelper.m +++ b/VVDocumenterTests/VVTestHelper.m @@ -3,8 +3,26 @@ // VVDocumenter-Xcode // // Created by 王 巍 on 13-7-19. -// Copyright (c) 2013年 OneV's Den. All rights reserved. // +// Copyright (c) 2015 Wei Wang +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. #import "VVTestHelper.h" @@ -30,7 +48,8 @@ +(NSArray *) testCodes { NSArray *methods = @[@"+ (ADTransition *)nullTransition;", @" - (BOOL) application: (UIApplication *) application \n didFinishLaunchingWithOptions: (NSDictionary *) launchOptions;", - @"- (id)initWithDuration:(CFTimeInterval)duration sourceRect:(CGRect)sourceRect {"]; + @"- (id)initWithDuration:(CFTimeInterval)duration sourceRect:(CGRect)sourceRect {", + @"-(void)whenLinked:(void (^)(void))actionHandler;"]; NSArray *functions = @[@"void dosomething ( int x, int y );", @"int main(int argc, char *argv[]) \n {", @@ -68,7 +87,13 @@ +(NSArray *) testCodes NSArray *swiftFunctions = @[@"func sayHello(personName: String) -> String {", @"func halfOpenRangeLength(start: Int, end: Int) -> Int\n {", - @"func sayHelloWorld() ->String"]; + @"func sayHelloWorld() ->String", + @"func testParamsType(var a: Int) {", + @"init(style: Style, gearing: Gearing, handlebar: Handlebar, frameSize centimeters: Int) {", + @"public subscript(key: KeyType)-> ValueType? {", + @"func methodCouldThrows(count: Int) throws -> Int {", + @"func methodCouldThrows() throws {", + @"func methodCouldThrows(count: Int, name: String, f: (Int, String) throws -> Void) rethrows -> Int {"]; /* //Now there is no difference between Objective-C (C) struct and Swift struct. Ignore this. @@ -86,14 +111,19 @@ +(NSArray *) testCodes @"lazy var importer = DataImporter()", @"private ( set ) var distanceTravelled:Double"]; - return @[methods,functions,properties,macros,structs,enums,unions,others,compileKeywords,swiftFunctions,swiftEnum,swiftProperties]; + NSArray *swiftExtension = @[@"extension SomeViewController: UITableViewDelegate {", + @"extension MyClass \n {", + @"private extension PP : DelegateA, DelegateB {"]; + + return @[methods,functions,properties,macros,structs,enums,unions,others,compileKeywords,swiftFunctions,swiftEnum,swiftProperties, swiftExtension]; } +(NSArray *) uniformCodes { NSArray *methods = @[@"+(ADTransition *)nullTransition;", @" -(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions;", - @"-(id)initWithDuration:(CFTimeInterval)duration sourceRect:(CGRect)sourceRect {"]; + @"-(id)initWithDuration:(CFTimeInterval)duration sourceRect:(CGRect)sourceRect {", + @"-(void)whenLinked:(void(^)(void))actionHandler;"]; NSArray *functions = @[@"void dosomething( int x, int y );", @"int main(int argc, char *argv[]){", @@ -106,7 +136,7 @@ +(NSArray *) uniformCodes NSArray *macros = @[@"#define MAX(A,B)({", @"#define MIN(A,B)((A)<(B)?(A):(B))", - @"#define ABS(A)((A)< 0 ?(-(A)) :(A))"]; + @"#define ABS(A)((A)< 0 ?(-(A)):(A))"]; NSArray *structs = @[@"struct Foo {", @" struct node {", @@ -132,7 +162,12 @@ +(NSArray *) uniformCodes NSArray *swiftFunctions = @[@"func sayHello(personName: String)-> String {", @"func halfOpenRangeLength(start: Int, end: Int)-> Int {", @"func sayHelloWorld()->String", - @"init(style: Style, gearing: Gearing, handlebar: Handlebar, frameSize centimeters: Int) {"]; + @"func testParamsType(var a: Int){", + @"init(style: Style, gearing: Gearing, handlebar: Handlebar, frameSize centimeters: Int){", + @"public subscript(key: KeyType)-> ValueType? {", + @"func methodCouldThrows(count: Int)throws -> Int {", + @"func methodCouldThrows()throws {", + @"func methodCouldThrows(count: Int, name: String, f:(Int, String)throws -> Void)rethrows -> Int {"]; /* //Now there is no difference between Objective-C (C) struct and Swift struct. Ignore this. @@ -150,7 +185,11 @@ +(NSArray *) uniformCodes @"lazy var importer = DataImporter()", @"private( set )var distanceTravelled:Double"]; - return @[methods,functions,properties,macros,structs,enums,unions,others,compileKeywords,swiftFunctions,swiftEnum,swiftProperties]; + NSArray *swiftExtension = @[@"extension SomeViewController: UITableViewDelegate {", + @"extension MyClass {", + @"private extension PP : DelegateA, DelegateB {"]; + + return @[methods,functions,properties,macros,structs,enums,unions,others,compileKeywords,swiftFunctions,swiftEnum,swiftProperties, swiftExtension]; } +(NSArray *) arrayOfExceptCodeType:(NSString *)type @@ -167,7 +206,8 @@ +(NSArray *) arrayOfExceptCodeType:(NSString *)type @"vv_isComplieKeyword", @"vv_isSwiftFunction", @"vv_isSwiftEnum", - @"vv_isSwiftProperty"]; + @"vv_isSwiftProperty", + @"vv_isSwiftExtension"]; } return [_typeStrings arrayByRemovingObject:type]; diff --git a/vvdocumenter-swift.gif b/vvdocumenter-swift.gif new file mode 100644 index 0000000..9522c90 Binary files /dev/null and b/vvdocumenter-swift.gif differ