├── .DS_Store ├── Pods ├── .DS_Store ├── Target Support Files │ ├── Sourceful │ │ ├── Sourceful.modulemap │ │ ├── Sourceful-dummy.m │ │ ├── Sourceful-prefix.pch │ │ ├── Sourceful-umbrella.h │ │ ├── Sourceful.debug.xcconfig │ │ ├── Sourceful.release.xcconfig │ │ └── Sourceful-Info.plist │ ├── libxlsxwriter │ │ ├── libxlsxwriter-dummy.m │ │ ├── libxlsxwriter.modulemap │ │ ├── libxlsxwriter-prefix.pch │ │ ├── libxlsxwriter.debug.xcconfig │ │ ├── libxlsxwriter.release.xcconfig │ │ └── libxlsxwriter-Info.plist │ └── Pods-LibXlsxWriterSwiftSample │ │ ├── Pods-LibXlsxWriterSwiftSample-frameworks-Debug-output-files.xcfilelist │ │ ├── Pods-LibXlsxWriterSwiftSample-frameworks-Release-output-files.xcfilelist │ │ ├── Pods-LibXlsxWriterSwiftSample.modulemap │ │ ├── Pods-LibXlsxWriterSwiftSample-dummy.m │ │ ├── Pods-LibXlsxWriterSwiftSample-frameworks-Debug-input-files.xcfilelist │ │ ├── Pods-LibXlsxWriterSwiftSample-frameworks-Release-input-files.xcfilelist │ │ ├── Pods-LibXlsxWriterSwiftSample-umbrella.h │ │ ├── Pods-LibXlsxWriterSwiftSample-Info.plist │ │ ├── Pods-LibXlsxWriterSwiftSample.debug.xcconfig │ │ └── Pods-LibXlsxWriterSwiftSample.release.xcconfig ├── libxlsxwriter │ ├── cocoapods │ │ └── libxlsxwriter.modulemap │ ├── include │ │ ├── xlsxwriter.h │ │ └── xlsxwriter │ │ │ ├── theme.h │ │ │ ├── libxlsxwriter-umbrella.h │ │ │ ├── core.h │ │ │ ├── metadata.h │ │ │ ├── custom.h │ │ │ ├── vml.h │ │ │ ├── third_party │ │ │ ├── emyg_dtoa.h │ │ │ ├── md5.h │ │ │ └── tmpfileplus.h │ │ │ ├── app.h │ │ │ ├── comment.h │ │ │ ├── relationships.h │ │ │ ├── hash_table.h │ │ │ ├── shared_strings.h │ │ │ ├── packager.h │ │ │ ├── drawing.h │ │ │ ├── content_types.h │ │ │ ├── styles.h │ │ │ └── xmlwriter.h │ ├── third_party │ │ ├── minizip │ │ │ ├── mztools.h │ │ │ ├── iowin32.h │ │ │ └── crypt.h │ │ ├── dtoa │ │ │ └── emyg_dtoa.h │ │ ├── md5 │ │ │ └── md5.h │ │ └── tmpfileplus │ │ │ └── tmpfileplus.h │ ├── Readme.md │ └── src │ │ ├── custom.c │ │ ├── relationships.c │ │ └── hash_table.c ├── Sourceful │ ├── Sources │ │ ├── Model │ │ │ ├── Lexer.swift │ │ │ ├── Token.swift │ │ │ ├── Paragraph.swift │ │ │ ├── SyntaxColorTheme.swift │ │ │ └── RegexLexer.swift │ │ ├── Util │ │ │ ├── String+Range.swift │ │ │ ├── NSTextView+UIKit.swift │ │ │ ├── Types.swift │ │ │ └── NSMutableAttributedString+Tokens.swift │ │ ├── SourceCodeToken.swift │ │ ├── SourceCodeTheme.swift │ │ ├── SourceCodeRegexLexer.swift │ │ ├── Themes │ │ │ └── DefaultSourceCodeTheme.swift │ │ ├── Languages │ │ │ ├── Python3Lexer.swift │ │ │ └── SwiftLexer.swift │ │ └── View │ │ │ ├── TextViewWrapperView.swift │ │ │ ├── SyntaxTextViewLayoutManager.swift │ │ │ ├── InnerTextView.swift │ │ │ ├── Paragraphs.swift │ │ │ └── LineNumberLayoutManager.swift │ ├── LICENSE │ └── README.md ├── Manifest.lock └── Pods.xcodeproj │ └── xcuserdata │ ├── michaelschaeffler.xcuserdatad │ └── xcschemes │ │ ├── xcschememanagement.plist │ │ ├── libxlsxwriter.xcscheme │ │ ├── Pods-LibXlsxWriterSwiftSample.xcscheme │ │ └── Sourceful.xcscheme │ └── ferdinandschaffler.xcuserdatad │ └── xcschemes │ ├── xcschememanagement.plist │ ├── libxlsxwriter.xcscheme │ ├── Pods-LibXlsxWriterSwiftSample.xcscheme │ └── Sourceful.xcscheme ├── LibXlsxWriterSwiftSample ├── .DS_Store ├── Assets.xcassets │ ├── Contents.json │ ├── logo.imageset │ │ ├── logo.png │ │ └── Contents.json │ └── AppIcon.appiconset │ │ ├── Logo2-20.png │ │ ├── Logo2-29.png │ │ ├── Logo2-40.png │ │ ├── Logo2-76.png │ │ ├── Logo2-1024.png │ │ ├── Logo2-20@2x.png │ │ ├── Logo2-20@3x.png │ │ ├── Logo2-29@2x.png │ │ ├── Logo2-29@3x.png │ │ ├── Logo2-40@2x.png │ │ ├── Logo2-40@3x.png │ │ ├── Logo2-60@2x.png │ │ ├── Logo2-60@3x.png │ │ ├── Logo2-76@2x.png │ │ ├── Logo2-83.5@2x.png │ │ └── Contents.json ├── Helpers │ └── Models │ │ └── Example.swift ├── Examples │ ├── Models │ │ └── tutorialStruct.swift │ ├── hello.swift │ ├── dates_and_times02.swift │ ├── dates_and_times01.swift │ ├── format_font.swift │ ├── tutorial1.swift │ ├── demo.swift │ ├── tutorial2.swift │ ├── hyperlinks.swift │ ├── anatomy.swift │ ├── dates_and_times03.swift │ ├── tutorial3.swift │ └── format_num_format.swift ├── AppDelegate.swift ├── Base.lproj │ ├── Main.storyboard │ └── LaunchScreen.storyboard ├── Views │ └── ItemCodePage.swift ├── Info.plist └── SceneDelegate.swift ├── AdditionalAssets └── screencast_edited.gif ├── LibXlsxWriterSwiftSample.xcodeproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcuserdata │ │ └── michaelschaeffler.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── xcuserdata │ ├── ferdinandschaffler.xcuserdatad │ └── xcschemes │ │ └── xcschememanagement.plist │ └── michaelschaeffler.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── LibXlsxWriterSwiftSample.xcworkspace ├── xcuserdata │ ├── michaelschaeffler.xcuserdatad │ │ ├── xcdebugger │ │ │ └── Breakpoints_v2.xcbkptlist │ │ └── UserInterfaceState.xcuserstate │ └── ferdinandschaffler.xcuserdatad │ │ └── UserInterfaceState.xcuserstate ├── xcshareddata │ └── IDEWorkspaceChecks.plist └── contents.xcworkspacedata ├── Podfile ├── Podfile.lock ├── README.md └── LICENSE.md /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FrankenApps/LibXlsxWriterSwiftSample/HEAD/.DS_Store -------------------------------------------------------------------------------- /Pods/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FrankenApps/LibXlsxWriterSwiftSample/HEAD/Pods/.DS_Store -------------------------------------------------------------------------------- /LibXlsxWriterSwiftSample/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FrankenApps/LibXlsxWriterSwiftSample/HEAD/LibXlsxWriterSwiftSample/.DS_Store -------------------------------------------------------------------------------- /LibXlsxWriterSwiftSample/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /AdditionalAssets/screencast_edited.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FrankenApps/LibXlsxWriterSwiftSample/HEAD/AdditionalAssets/screencast_edited.gif -------------------------------------------------------------------------------- /Pods/Target Support Files/Sourceful/Sourceful.modulemap: -------------------------------------------------------------------------------- 1 | framework module Sourceful { 2 | umbrella header "Sourceful-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /LibXlsxWriterSwiftSample/Assets.xcassets/logo.imageset/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FrankenApps/LibXlsxWriterSwiftSample/HEAD/LibXlsxWriterSwiftSample/Assets.xcassets/logo.imageset/logo.png -------------------------------------------------------------------------------- /Pods/Target Support Files/Sourceful/Sourceful-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Sourceful : NSObject 3 | @end 4 | @implementation PodsDummy_Sourceful 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/libxlsxwriter/libxlsxwriter-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_libxlsxwriter : NSObject 3 | @end 4 | @implementation PodsDummy_libxlsxwriter 5 | @end 6 | -------------------------------------------------------------------------------- /LibXlsxWriterSwiftSample/Assets.xcassets/AppIcon.appiconset/Logo2-20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FrankenApps/LibXlsxWriterSwiftSample/HEAD/LibXlsxWriterSwiftSample/Assets.xcassets/AppIcon.appiconset/Logo2-20.png -------------------------------------------------------------------------------- /LibXlsxWriterSwiftSample/Assets.xcassets/AppIcon.appiconset/Logo2-29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FrankenApps/LibXlsxWriterSwiftSample/HEAD/LibXlsxWriterSwiftSample/Assets.xcassets/AppIcon.appiconset/Logo2-29.png -------------------------------------------------------------------------------- /LibXlsxWriterSwiftSample/Assets.xcassets/AppIcon.appiconset/Logo2-40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FrankenApps/LibXlsxWriterSwiftSample/HEAD/LibXlsxWriterSwiftSample/Assets.xcassets/AppIcon.appiconset/Logo2-40.png -------------------------------------------------------------------------------- /LibXlsxWriterSwiftSample/Assets.xcassets/AppIcon.appiconset/Logo2-76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FrankenApps/LibXlsxWriterSwiftSample/HEAD/LibXlsxWriterSwiftSample/Assets.xcassets/AppIcon.appiconset/Logo2-76.png -------------------------------------------------------------------------------- /LibXlsxWriterSwiftSample/Assets.xcassets/AppIcon.appiconset/Logo2-1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FrankenApps/LibXlsxWriterSwiftSample/HEAD/LibXlsxWriterSwiftSample/Assets.xcassets/AppIcon.appiconset/Logo2-1024.png -------------------------------------------------------------------------------- /LibXlsxWriterSwiftSample/Assets.xcassets/AppIcon.appiconset/Logo2-20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FrankenApps/LibXlsxWriterSwiftSample/HEAD/LibXlsxWriterSwiftSample/Assets.xcassets/AppIcon.appiconset/Logo2-20@2x.png -------------------------------------------------------------------------------- /LibXlsxWriterSwiftSample/Assets.xcassets/AppIcon.appiconset/Logo2-20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FrankenApps/LibXlsxWriterSwiftSample/HEAD/LibXlsxWriterSwiftSample/Assets.xcassets/AppIcon.appiconset/Logo2-20@3x.png -------------------------------------------------------------------------------- /LibXlsxWriterSwiftSample/Assets.xcassets/AppIcon.appiconset/Logo2-29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FrankenApps/LibXlsxWriterSwiftSample/HEAD/LibXlsxWriterSwiftSample/Assets.xcassets/AppIcon.appiconset/Logo2-29@2x.png -------------------------------------------------------------------------------- /LibXlsxWriterSwiftSample/Assets.xcassets/AppIcon.appiconset/Logo2-29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FrankenApps/LibXlsxWriterSwiftSample/HEAD/LibXlsxWriterSwiftSample/Assets.xcassets/AppIcon.appiconset/Logo2-29@3x.png -------------------------------------------------------------------------------- /LibXlsxWriterSwiftSample/Assets.xcassets/AppIcon.appiconset/Logo2-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FrankenApps/LibXlsxWriterSwiftSample/HEAD/LibXlsxWriterSwiftSample/Assets.xcassets/AppIcon.appiconset/Logo2-40@2x.png -------------------------------------------------------------------------------- /LibXlsxWriterSwiftSample/Assets.xcassets/AppIcon.appiconset/Logo2-40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FrankenApps/LibXlsxWriterSwiftSample/HEAD/LibXlsxWriterSwiftSample/Assets.xcassets/AppIcon.appiconset/Logo2-40@3x.png -------------------------------------------------------------------------------- /LibXlsxWriterSwiftSample/Assets.xcassets/AppIcon.appiconset/Logo2-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FrankenApps/LibXlsxWriterSwiftSample/HEAD/LibXlsxWriterSwiftSample/Assets.xcassets/AppIcon.appiconset/Logo2-60@2x.png -------------------------------------------------------------------------------- /LibXlsxWriterSwiftSample/Assets.xcassets/AppIcon.appiconset/Logo2-60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FrankenApps/LibXlsxWriterSwiftSample/HEAD/LibXlsxWriterSwiftSample/Assets.xcassets/AppIcon.appiconset/Logo2-60@3x.png -------------------------------------------------------------------------------- /LibXlsxWriterSwiftSample/Assets.xcassets/AppIcon.appiconset/Logo2-76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FrankenApps/LibXlsxWriterSwiftSample/HEAD/LibXlsxWriterSwiftSample/Assets.xcassets/AppIcon.appiconset/Logo2-76@2x.png -------------------------------------------------------------------------------- /LibXlsxWriterSwiftSample/Assets.xcassets/AppIcon.appiconset/Logo2-83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FrankenApps/LibXlsxWriterSwiftSample/HEAD/LibXlsxWriterSwiftSample/Assets.xcassets/AppIcon.appiconset/Logo2-83.5@2x.png -------------------------------------------------------------------------------- /Pods/libxlsxwriter/cocoapods/libxlsxwriter.modulemap: -------------------------------------------------------------------------------- 1 | framework module xlsxwriter { 2 | umbrella header "xlsxwriter/libxlsxwriter-umbrella.h" 3 | header "xlsxwriter.h" 4 | 5 | export * 6 | module * { export * } 7 | } 8 | -------------------------------------------------------------------------------- /Pods/Target Support Files/libxlsxwriter/libxlsxwriter.modulemap: -------------------------------------------------------------------------------- 1 | framework module xlsxwriter { 2 | umbrella header "xlsxwriter/libxlsxwriter-umbrella.h" 3 | header "xlsxwriter.h" 4 | 5 | export * 6 | module * { export * } 7 | } 8 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-LibXlsxWriterSwiftSample/Pods-LibXlsxWriterSwiftSample-frameworks-Debug-output-files.xcfilelist: -------------------------------------------------------------------------------- 1 | ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Sourceful.framework 2 | ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/xlsxwriter.framework -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-LibXlsxWriterSwiftSample/Pods-LibXlsxWriterSwiftSample-frameworks-Release-output-files.xcfilelist: -------------------------------------------------------------------------------- 1 | ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Sourceful.framework 2 | ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/xlsxwriter.framework -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-LibXlsxWriterSwiftSample/Pods-LibXlsxWriterSwiftSample.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_LibXlsxWriterSwiftSample { 2 | umbrella header "Pods-LibXlsxWriterSwiftSample-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /LibXlsxWriterSwiftSample.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /LibXlsxWriterSwiftSample.xcworkspace/xcuserdata/michaelschaeffler.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-LibXlsxWriterSwiftSample/Pods-LibXlsxWriterSwiftSample-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_LibXlsxWriterSwiftSample : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_LibXlsxWriterSwiftSample 5 | @end 6 | -------------------------------------------------------------------------------- /LibXlsxWriterSwiftSample.xcworkspace/xcuserdata/michaelschaeffler.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FrankenApps/LibXlsxWriterSwiftSample/HEAD/LibXlsxWriterSwiftSample.xcworkspace/xcuserdata/michaelschaeffler.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /LibXlsxWriterSwiftSample.xcworkspace/xcuserdata/ferdinandschaffler.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FrankenApps/LibXlsxWriterSwiftSample/HEAD/LibXlsxWriterSwiftSample.xcworkspace/xcuserdata/ferdinandschaffler.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Pods/Target Support Files/Sourceful/Sourceful-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Pods/Target Support Files/libxlsxwriter/libxlsxwriter-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /LibXlsxWriterSwiftSample.xcodeproj/project.xcworkspace/xcuserdata/michaelschaeffler.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FrankenApps/LibXlsxWriterSwiftSample/HEAD/LibXlsxWriterSwiftSample.xcodeproj/project.xcworkspace/xcuserdata/michaelschaeffler.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /LibXlsxWriterSwiftSample/Helpers/Models/Example.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Example.swift 3 | // LibXlsxWriterSwiftSample 4 | // 5 | 6 | import Foundation 7 | 8 | struct Example { 9 | var id: Int! 10 | var title: String! 11 | var subtitle: String! 12 | var code: String! 13 | var generateFunction: (() -> URL)! 14 | } 15 | -------------------------------------------------------------------------------- /LibXlsxWriterSwiftSample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-LibXlsxWriterSwiftSample/Pods-LibXlsxWriterSwiftSample-frameworks-Debug-input-files.xcfilelist: -------------------------------------------------------------------------------- 1 | ${PODS_ROOT}/Target Support Files/Pods-LibXlsxWriterSwiftSample/Pods-LibXlsxWriterSwiftSample-frameworks.sh 2 | ${BUILT_PRODUCTS_DIR}/Sourceful/Sourceful.framework 3 | ${BUILT_PRODUCTS_DIR}/libxlsxwriter/xlsxwriter.framework -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-LibXlsxWriterSwiftSample/Pods-LibXlsxWriterSwiftSample-frameworks-Release-input-files.xcfilelist: -------------------------------------------------------------------------------- 1 | ${PODS_ROOT}/Target Support Files/Pods-LibXlsxWriterSwiftSample/Pods-LibXlsxWriterSwiftSample-frameworks.sh 2 | ${BUILT_PRODUCTS_DIR}/Sourceful/Sourceful.framework 3 | ${BUILT_PRODUCTS_DIR}/libxlsxwriter/xlsxwriter.framework -------------------------------------------------------------------------------- /LibXlsxWriterSwiftSample.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Pods/Sourceful/Sources/Model/Lexer.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Lexer.swift 3 | // SavannaKit iOS 4 | // 5 | // Created by Louis D'hauwe on 04/02/2018. 6 | // Copyright © 2018 Silver Fox. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public protocol Lexer { 12 | 13 | func getSavannaTokens(input: String) -> [Token] 14 | 15 | } 16 | -------------------------------------------------------------------------------- /LibXlsxWriterSwiftSample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Pods/Sourceful/Sources/Util/String+Range.swift: -------------------------------------------------------------------------------- 1 | // 2 | // String+Range.swift 3 | // SavannaKit 4 | // 5 | // Created by Louis D'hauwe on 09/07/2017. 6 | // Copyright © 2017 Silver Fox. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | extension String { 12 | 13 | func nsRange(fromRange range: Range) -> NSRange { 14 | return NSRange(range, in: self) 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment the next line to define a global platform for your project 2 | platform :ios, '13.0' 3 | 4 | target 'LibXlsxWriterSwiftSample' do 5 | # Comment the next line if you don't want to use dynamic frameworks 6 | use_frameworks! 7 | 8 | # Pods for LibXlsxWriterSwiftSample 9 | pod 'libxlsxwriter', '~> 1.1' 10 | pod 'Sourceful', '~> 0.2' #Only present for synzax highlighting 11 | 12 | end 13 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Sourceful/Sourceful-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double SourcefulVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char SourcefulVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /LibXlsxWriterSwiftSample/Assets.xcassets/logo.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "logo.png", 5 | "idiom" : "universal", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - libxlsxwriter (1.1.1) 3 | - Sourceful (0.2.0) 4 | 5 | DEPENDENCIES: 6 | - libxlsxwriter (~> 1.1) 7 | - Sourceful (~> 0.2) 8 | 9 | SPEC REPOS: 10 | trunk: 11 | - libxlsxwriter 12 | - Sourceful 13 | 14 | SPEC CHECKSUMS: 15 | libxlsxwriter: 964f8204a24bbbcb689bdc4c7e097d79e8313ca2 16 | Sourceful: f514447f2ee886f238face3ce8e8b5648c0dc365 17 | 18 | PODFILE CHECKSUM: 7be3d6e07a422dbb8ab37920e9f5224ec513e0ea 19 | 20 | COCOAPODS: 1.10.1 21 | -------------------------------------------------------------------------------- /Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - libxlsxwriter (1.1.1) 3 | - Sourceful (0.2.0) 4 | 5 | DEPENDENCIES: 6 | - libxlsxwriter (~> 1.1) 7 | - Sourceful (~> 0.2) 8 | 9 | SPEC REPOS: 10 | trunk: 11 | - libxlsxwriter 12 | - Sourceful 13 | 14 | SPEC CHECKSUMS: 15 | libxlsxwriter: 964f8204a24bbbcb689bdc4c7e097d79e8313ca2 16 | Sourceful: f514447f2ee886f238face3ce8e8b5648c0dc365 17 | 18 | PODFILE CHECKSUM: 7be3d6e07a422dbb8ab37920e9f5224ec513e0ea 19 | 20 | COCOAPODS: 1.10.1 21 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-LibXlsxWriterSwiftSample/Pods-LibXlsxWriterSwiftSample-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double Pods_LibXlsxWriterSwiftSampleVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_LibXlsxWriterSwiftSampleVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /LibXlsxWriterSwiftSample.xcodeproj/xcuserdata/ferdinandschaffler.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | LibXlsxWriterSwiftSample.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 3 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /LibXlsxWriterSwiftSample.xcodeproj/xcuserdata/michaelschaeffler.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | LibXlsxWriterSwiftSample.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 3 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Pods/Sourceful/Sources/Util/NSTextView+UIKit.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NSTextView+UIKit.swift 3 | // SavannaKit 4 | // 5 | // Created by Louis D'hauwe on 09/07/2017. 6 | // Copyright © 2017 Silver Fox. All rights reserved. 7 | // 8 | 9 | #if os(macOS) 10 | 11 | import AppKit 12 | 13 | extension NSTextView { 14 | 15 | var text: String! { 16 | get { 17 | return string 18 | } 19 | set { 20 | self.string = newValue 21 | } 22 | } 23 | 24 | var tintColor: Color { 25 | set { 26 | insertionPointColor = newValue 27 | } 28 | get { 29 | return insertionPointColor 30 | } 31 | } 32 | 33 | } 34 | 35 | #endif -------------------------------------------------------------------------------- /LibXlsxWriterSwiftSample/Examples/Models/tutorialStruct.swift: -------------------------------------------------------------------------------- 1 | // 2 | // tutorialStruct.swift 3 | // LibXlsxWriterSwiftSample 4 | // 5 | 6 | import xlsxwriter 7 | 8 | // Some data we want to write to the worksheet. 9 | struct Expense { 10 | let item: String! 11 | let cost: Double! 12 | var datetime: lxw_datetime? = nil 13 | 14 | init(item: String, cost: Double) { 15 | self.item = item 16 | self.cost = cost 17 | } 18 | 19 | init(item: String, cost: Double, datetime: lxw_datetime) { 20 | self.item = item 21 | self.cost = cost 22 | self.datetime = datetime 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Pods/libxlsxwriter/include/xlsxwriter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libxlsxwriter 3 | * 4 | * Copyright 2014-2021, John McNamara, jmcnamara@cpan.org. See LICENSE.txt. 5 | */ 6 | 7 | /** 8 | * @file xlsxwriter.h 9 | * 10 | * xlsxwriter - A library for creating Excel XLSX files. 11 | * 12 | */ 13 | #ifndef __LXW_XLSXWRITER_H__ 14 | #define __LXW_XLSXWRITER_H__ 15 | 16 | #include "xlsxwriter/workbook.h" 17 | #include "xlsxwriter/worksheet.h" 18 | #include "xlsxwriter/format.h" 19 | #include "xlsxwriter/utility.h" 20 | 21 | #define LXW_VERSION "1.1.1" 22 | #define LXW_VERSION_ID 111 23 | #define LXW_SOVERSION "2.1" 24 | 25 | #endif /* __LXW_XLSXWRITER_H__ */ 26 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Sourceful/Sourceful.debug.xcconfig: -------------------------------------------------------------------------------- 1 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO 2 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Sourceful 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 5 | PODS_BUILD_DIR = ${BUILD_DIR} 6 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_ROOT = ${SRCROOT} 8 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/Sourceful 9 | PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates 10 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 11 | SKIP_INSTALL = YES 12 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 13 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Sourceful/Sourceful.release.xcconfig: -------------------------------------------------------------------------------- 1 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO 2 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Sourceful 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 5 | PODS_BUILD_DIR = ${BUILD_DIR} 6 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_ROOT = ${SRCROOT} 8 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/Sourceful 9 | PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates 10 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 11 | SKIP_INSTALL = YES 12 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 13 | -------------------------------------------------------------------------------- /Pods/Target Support Files/libxlsxwriter/libxlsxwriter.debug.xcconfig: -------------------------------------------------------------------------------- 1 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO 2 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/libxlsxwriter 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | OTHER_LDFLAGS = $(inherited) -l"z" 5 | PODS_BUILD_DIR = ${BUILD_DIR} 6 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_ROOT = ${SRCROOT} 8 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/libxlsxwriter 9 | PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates 10 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 11 | SKIP_INSTALL = YES 12 | USER_HEADER_SEARCH_PATHS = ${PODS_ROOT}/libxlsxwriter/include 13 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 14 | -------------------------------------------------------------------------------- /Pods/Target Support Files/libxlsxwriter/libxlsxwriter.release.xcconfig: -------------------------------------------------------------------------------- 1 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO 2 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/libxlsxwriter 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | OTHER_LDFLAGS = $(inherited) -l"z" 5 | PODS_BUILD_DIR = ${BUILD_DIR} 6 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_ROOT = ${SRCROOT} 8 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/libxlsxwriter 9 | PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates 10 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 11 | SKIP_INSTALL = YES 12 | USER_HEADER_SEARCH_PATHS = ${PODS_ROOT}/libxlsxwriter/include 13 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 14 | -------------------------------------------------------------------------------- /LibXlsxWriterSwiftSample/Examples/hello.swift: -------------------------------------------------------------------------------- 1 | // 2 | // hello.swift 3 | // LibXlsxWriterSwiftSample 4 | // 5 | import Foundation 6 | import xlsxwriter 7 | 8 | class Hello{ 9 | func generate() -> URL { 10 | let documentDirectory = try! FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor:nil, create:false) 11 | let fileURL = documentDirectory.appendingPathComponent("hello_world.xlsx") 12 | 13 | let workbook = workbook_new((fileURL.absoluteString.dropFirst(6) as NSString).fileSystemRepresentation) 14 | let worksheet = workbook_add_worksheet(workbook, nil) 15 | worksheet_write_string(worksheet, 0, 0, "Hello", nil) 16 | worksheet_write_number(worksheet, 1, 0, 123, nil) 17 | workbook_close(workbook) 18 | 19 | return fileURL 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Pods/Sourceful/Sources/SourceCodeToken.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SourceCodeToken.swift 3 | // SourceEditor 4 | // 5 | // Created by Louis D'hauwe on 24/07/2018. 6 | // Copyright © 2018 Silver Fox. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public enum SourceCodeTokenType { 12 | case plain 13 | case number 14 | case string 15 | case identifier 16 | case keyword 17 | case comment 18 | case editorPlaceholder 19 | } 20 | 21 | protocol SourceCodeToken: Token { 22 | 23 | var type: SourceCodeTokenType { get } 24 | 25 | } 26 | 27 | extension SourceCodeToken { 28 | 29 | var isEditorPlaceholder: Bool { 30 | return type == .editorPlaceholder 31 | } 32 | 33 | var isPlain: Bool { 34 | return type == .plain 35 | } 36 | 37 | } 38 | 39 | struct SimpleSourceCodeToken: SourceCodeToken { 40 | 41 | let type: SourceCodeTokenType 42 | 43 | let range: Range 44 | 45 | } 46 | -------------------------------------------------------------------------------- /Pods/libxlsxwriter/third_party/minizip/mztools.h: -------------------------------------------------------------------------------- 1 | /* 2 | Additional tools for Minizip 3 | Code: Xavier Roche '2004 4 | License: Same as ZLIB (www.gzip.org) 5 | */ 6 | 7 | #ifndef _zip_tools_H 8 | #define _zip_tools_H 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #ifndef _ZLIB_H 15 | #include "zlib.h" 16 | #endif 17 | 18 | #include "unzip.h" 19 | 20 | /* Repair a ZIP file (missing central directory) 21 | file: file to recover 22 | fileOut: output file after recovery 23 | fileOutTmp: temporary file name used for recovery 24 | */ 25 | extern int ZEXPORT unzRepair(const char* file, 26 | const char* fileOut, 27 | const char* fileOutTmp, 28 | uLong* nRecovered, 29 | uLong* bytesRecovered); 30 | 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /Pods/Sourceful/Sources/Model/Token.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Token.swift 3 | // SavannaKit iOS 4 | // 5 | // Created by Louis D'hauwe on 04/02/2018. 6 | // Copyright © 2018 Silver Fox. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public protocol Token { 12 | 13 | /// When true, this token will be treated as a placeholder. 14 | /// Users can tab between placeholder. Typing in a placeholder replaces 15 | /// it completely. 16 | var isEditorPlaceholder: Bool { get } 17 | 18 | /// When true, no attributes will be requested for this token. 19 | /// This causes a performance win for a large amount of tokens 20 | /// that don't require any attributes. 21 | var isPlain: Bool { get } 22 | 23 | /// The range of the token in the source string. 24 | var range: Range { get } 25 | 26 | } 27 | 28 | struct CachedToken { 29 | 30 | let token: Token 31 | let nsRange: NSRange 32 | 33 | } 34 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/michaelschaeffler.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Pods-LibXlsxWriterSwiftSample.xcscheme 8 | 9 | isShown 10 | 11 | orderHint 12 | 1 13 | 14 | Sourceful.xcscheme 15 | 16 | isShown 17 | 18 | orderHint 19 | 2 20 | 21 | libxlsxwriter.xcscheme 22 | 23 | isShown 24 | 25 | orderHint 26 | 0 27 | 28 | 29 | SuppressBuildableAutocreation 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/ferdinandschaffler.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Pods-LibXlsxWriterSwiftSample.xcscheme 8 | 9 | isShown 10 | 11 | orderHint 12 | 1 13 | 14 | Sourceful.xcscheme 15 | 16 | isShown 17 | 18 | orderHint 19 | 2 20 | 21 | libxlsxwriter.xcscheme 22 | 23 | isShown 24 | 25 | orderHint 26 | 0 27 | 28 | 29 | SuppressBuildableAutocreation 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Sourceful/Sourceful-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 0.2.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/libxlsxwriter/libxlsxwriter-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.1.1 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/libxlsxwriter/third_party/minizip/iowin32.h: -------------------------------------------------------------------------------- 1 | /* iowin32.h -- IO base function header for compress/uncompress .zip 2 | Version 1.1, February 14h, 2010 3 | part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html ) 4 | 5 | Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html ) 6 | 7 | Modifications for Zip64 support 8 | Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) 9 | 10 | For more info read MiniZip_info.txt 11 | 12 | */ 13 | 14 | #include 15 | 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | void fill_win32_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def)); 22 | void fill_win32_filefunc64 OF((zlib_filefunc64_def* pzlib_filefunc_def)); 23 | void fill_win32_filefunc64A OF((zlib_filefunc64_def* pzlib_filefunc_def)); 24 | void fill_win32_filefunc64W OF((zlib_filefunc64_def* pzlib_filefunc_def)); 25 | 26 | #ifdef __cplusplus 27 | } 28 | #endif 29 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-LibXlsxWriterSwiftSample/Pods-LibXlsxWriterSwiftSample-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Sourceful/Sources/SourceCodeTheme.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SourceCodeTheme.swift 3 | // SourceEditor 4 | // 5 | // Created by Louis D'hauwe on 24/07/2018. 6 | // Copyright © 2018 Silver Fox. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public protocol SourceCodeTheme: SyntaxColorTheme { 12 | 13 | func color(for syntaxColorType: SourceCodeTokenType) -> Color 14 | 15 | } 16 | 17 | extension SourceCodeTheme { 18 | 19 | public func globalAttributes() -> [NSAttributedString.Key: Any] { 20 | 21 | var attributes = [NSAttributedString.Key: Any]() 22 | 23 | attributes[.font] = font 24 | attributes[.foregroundColor] = Color.white 25 | 26 | return attributes 27 | } 28 | 29 | public func attributes(for token: Token) -> [NSAttributedString.Key: Any] { 30 | var attributes = [NSAttributedString.Key: Any]() 31 | 32 | if let token = token as? SimpleSourceCodeToken { 33 | attributes[.foregroundColor] = color(for: token.type) 34 | } 35 | 36 | return attributes 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /Pods/libxlsxwriter/include/xlsxwriter/theme.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libxlsxwriter 3 | * 4 | * Copyright 2014-2021, John McNamara, jmcnamara@cpan.org. See LICENSE.txt. 5 | * 6 | * theme - A libxlsxwriter library for creating Excel XLSX theme files. 7 | * 8 | */ 9 | #ifndef __LXW_THEME_H__ 10 | #define __LXW_THEME_H__ 11 | 12 | #include 13 | 14 | #include "common.h" 15 | 16 | /* 17 | * Struct to represent a theme. 18 | */ 19 | typedef struct lxw_theme { 20 | 21 | FILE *file; 22 | } lxw_theme; 23 | 24 | 25 | /* *INDENT-OFF* */ 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | /* *INDENT-ON* */ 30 | 31 | lxw_theme *lxw_theme_new(void); 32 | void lxw_theme_free(lxw_theme *theme); 33 | void lxw_theme_xml_declaration(lxw_theme *self); 34 | void lxw_theme_assemble_xml_file(lxw_theme *self); 35 | 36 | /* Declarations required for unit testing. */ 37 | #ifdef TESTING 38 | 39 | #endif /* TESTING */ 40 | 41 | /* *INDENT-OFF* */ 42 | #ifdef __cplusplus 43 | } 44 | #endif 45 | /* *INDENT-ON* */ 46 | 47 | #endif /* __LXW_THEME_H__ */ 48 | -------------------------------------------------------------------------------- /Pods/libxlsxwriter/include/xlsxwriter/libxlsxwriter-umbrella.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "../xlsxwriter.h" 4 | #import "app.h" 5 | #import "chart.h" 6 | #import "chartsheet.h" 7 | #import "comment.h" 8 | #import "common.h" 9 | #import "content_types.h" 10 | #import "core.h" 11 | #import "custom.h" 12 | #import "drawing.h" 13 | #import "format.h" 14 | #import "hash_table.h" 15 | #import "metadata.h" 16 | #import "packager.h" 17 | #import "relationships.h" 18 | #import "shared_strings.h" 19 | #import "styles.h" 20 | #import "theme.h" 21 | #import "third_party/emyg_dtoa.h" 22 | #import "third_party/ioapi.h" 23 | #import "third_party/md5.h" 24 | #import "third_party/queue.h" 25 | #import "third_party/tmpfileplus.h" 26 | #import "third_party/tree.h" 27 | #import "third_party/zip.h" 28 | #import "utility.h" 29 | #import "vml.h" 30 | #import "workbook.h" 31 | #import "worksheet.h" 32 | #import "xmlwriter.h" 33 | 34 | FOUNDATION_EXPORT double xlsxwriterVersionNumber; 35 | FOUNDATION_EXPORT const unsigned char xlsxwriterVersionString[]; 36 | 37 | -------------------------------------------------------------------------------- /Pods/Sourceful/Sources/Model/Paragraph.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Paragraph.swift 3 | // SavannaKit 4 | // 5 | // Created by Louis D'hauwe on 24/06/2017. 6 | // Copyright © 2017 Silver Fox. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import CoreGraphics 11 | 12 | #if os(macOS) 13 | import AppKit 14 | #else 15 | import UIKit 16 | #endif 17 | 18 | struct Paragraph { 19 | 20 | var rect: CGRect 21 | let number: Int 22 | 23 | var string: String { 24 | return "\(number)" 25 | } 26 | 27 | func attributedString(for style: LineNumbersStyle) -> NSAttributedString { 28 | 29 | let attr = NSMutableAttributedString(string: string) 30 | let range = NSMakeRange(0, attr.length) 31 | 32 | let attributes: [NSAttributedString.Key: Any] = [ 33 | .font: style.font, 34 | .foregroundColor : style.textColor 35 | ] 36 | 37 | attr.addAttributes(attributes, range: range) 38 | 39 | return attr 40 | } 41 | 42 | func drawSize(for style: LineNumbersStyle) -> CGSize { 43 | return attributedString(for: style).size() 44 | } 45 | 46 | } 47 | 48 | -------------------------------------------------------------------------------- /Pods/libxlsxwriter/include/xlsxwriter/core.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libxlsxwriter 3 | * 4 | * Copyright 2014-2021, John McNamara, jmcnamara@cpan.org. See LICENSE.txt. 5 | * 6 | * core - A libxlsxwriter library for creating Excel XLSX core files. 7 | * 8 | */ 9 | #ifndef __LXW_CORE_H__ 10 | #define __LXW_CORE_H__ 11 | 12 | #include 13 | 14 | #include "workbook.h" 15 | #include "common.h" 16 | 17 | /* 18 | * Struct to represent a core. 19 | */ 20 | typedef struct lxw_core { 21 | 22 | FILE *file; 23 | lxw_doc_properties *properties; 24 | 25 | } lxw_core; 26 | 27 | 28 | /* *INDENT-OFF* */ 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | /* *INDENT-ON* */ 33 | 34 | lxw_core *lxw_core_new(void); 35 | void lxw_core_free(lxw_core *core); 36 | void lxw_core_assemble_xml_file(lxw_core *self); 37 | 38 | /* Declarations required for unit testing. */ 39 | #ifdef TESTING 40 | 41 | STATIC void _core_xml_declaration(lxw_core *self); 42 | 43 | #endif /* TESTING */ 44 | 45 | /* *INDENT-OFF* */ 46 | #ifdef __cplusplus 47 | } 48 | #endif 49 | /* *INDENT-ON* */ 50 | 51 | #endif /* __LXW_CORE_H__ */ 52 | -------------------------------------------------------------------------------- /Pods/libxlsxwriter/include/xlsxwriter/metadata.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libxlsxwriter 3 | * 4 | * Copyright 2014-2021, John McNamara, jmcnamara@cpan.org. See LICENSE.txt. 5 | * 6 | * metadata - A libxlsxwriter library for creating Excel XLSX metadata files. 7 | * 8 | */ 9 | #ifndef __LXW_METADATA_H__ 10 | #define __LXW_METADATA_H__ 11 | 12 | #include 13 | 14 | #include "common.h" 15 | 16 | /* 17 | * Struct to represent a metadata object. 18 | */ 19 | typedef struct lxw_metadata { 20 | 21 | FILE *file; 22 | 23 | } lxw_metadata; 24 | 25 | 26 | /* *INDENT-OFF* */ 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | /* *INDENT-ON* */ 31 | 32 | lxw_metadata *lxw_metadata_new(void); 33 | void lxw_metadata_free(lxw_metadata *metadata); 34 | void lxw_metadata_assemble_xml_file(lxw_metadata *self); 35 | 36 | /* Declarations required for unit testing. */ 37 | #ifdef TESTING 38 | 39 | STATIC void _metadata_xml_declaration(lxw_metadata *self); 40 | 41 | #endif /* TESTING */ 42 | 43 | /* *INDENT-OFF* */ 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | /* *INDENT-ON* */ 48 | 49 | #endif /* __LXW_METADATA_H__ */ 50 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-LibXlsxWriterSwiftSample/Pods-LibXlsxWriterSwiftSample.debug.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO 3 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Sourceful" "${PODS_CONFIGURATION_BUILD_DIR}/libxlsxwriter" 4 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 5 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Sourceful/Sourceful.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/libxlsxwriter/xlsxwriter.framework/Headers" 6 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 7 | OTHER_LDFLAGS = $(inherited) -l"z" -framework "Sourceful" -framework "xlsxwriter" 8 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 9 | PODS_BUILD_DIR = ${BUILD_DIR} 10 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 11 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 12 | PODS_ROOT = ${SRCROOT}/Pods 13 | PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates 14 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 15 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-LibXlsxWriterSwiftSample/Pods-LibXlsxWriterSwiftSample.release.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO 3 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Sourceful" "${PODS_CONFIGURATION_BUILD_DIR}/libxlsxwriter" 4 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 5 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Sourceful/Sourceful.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/libxlsxwriter/xlsxwriter.framework/Headers" 6 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 7 | OTHER_LDFLAGS = $(inherited) -l"z" -framework "Sourceful" -framework "xlsxwriter" 8 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 9 | PODS_BUILD_DIR = ${BUILD_DIR} 10 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 11 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 12 | PODS_ROOT = ${SRCROOT}/Pods 13 | PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates 14 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 15 | -------------------------------------------------------------------------------- /Pods/Sourceful/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Louis D'hauwe, Paul Hudson 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Pods/libxlsxwriter/include/xlsxwriter/custom.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libxlsxwriter 3 | * 4 | * Copyright 2014-2021, John McNamara, jmcnamara@cpan.org. See LICENSE.txt. 5 | * 6 | * custom - A libxlsxwriter library for creating Excel custom property files. 7 | * 8 | */ 9 | #ifndef __LXW_CUSTOM_H__ 10 | #define __LXW_CUSTOM_H__ 11 | 12 | #include 13 | 14 | #include "common.h" 15 | 16 | /* 17 | * Struct to represent a custom property file object. 18 | */ 19 | typedef struct lxw_custom { 20 | 21 | FILE *file; 22 | 23 | struct lxw_custom_properties *custom_properties; 24 | uint32_t pid; 25 | 26 | } lxw_custom; 27 | 28 | 29 | /* *INDENT-OFF* */ 30 | #ifdef __cplusplus 31 | extern "C" { 32 | #endif 33 | /* *INDENT-ON* */ 34 | 35 | lxw_custom *lxw_custom_new(void); 36 | void lxw_custom_free(lxw_custom *custom); 37 | void lxw_custom_assemble_xml_file(lxw_custom *self); 38 | 39 | /* Declarations required for unit testing. */ 40 | #ifdef TESTING 41 | 42 | STATIC void _custom_xml_declaration(lxw_custom *self); 43 | 44 | #endif /* TESTING */ 45 | 46 | /* *INDENT-OFF* */ 47 | #ifdef __cplusplus 48 | } 49 | #endif 50 | /* *INDENT-ON* */ 51 | 52 | #endif /* __LXW_CUSTOM_H__ */ 53 | -------------------------------------------------------------------------------- /Pods/libxlsxwriter/include/xlsxwriter/vml.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libxlsxwriter 3 | * 4 | * Copyright 2014-2021, John McNamara, jmcnamara@cpan.org. See LICENSE.txt. 5 | * 6 | * vml - A libxlsxwriter library for creating Excel XLSX vml files. 7 | * 8 | */ 9 | #ifndef __LXW_VML_H__ 10 | #define __LXW_VML_H__ 11 | 12 | #include 13 | 14 | #include "common.h" 15 | #include "worksheet.h" 16 | 17 | /* 18 | * Struct to represent a vml object. 19 | */ 20 | typedef struct lxw_vml { 21 | 22 | FILE *file; 23 | uint8_t type; 24 | struct lxw_comment_objs *button_objs; 25 | struct lxw_comment_objs *comment_objs; 26 | struct lxw_comment_objs *image_objs; 27 | char *vml_data_id_str; 28 | uint32_t vml_shape_id; 29 | uint8_t comment_display_default; 30 | 31 | } lxw_vml; 32 | 33 | 34 | /* *INDENT-OFF* */ 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | /* *INDENT-ON* */ 39 | 40 | lxw_vml *lxw_vml_new(void); 41 | void lxw_vml_free(lxw_vml *vml); 42 | void lxw_vml_assemble_xml_file(lxw_vml *self); 43 | 44 | /* Declarations required for unit testing. */ 45 | #ifdef TESTING 46 | 47 | #endif /* TESTING */ 48 | 49 | /* *INDENT-OFF* */ 50 | #ifdef __cplusplus 51 | } 52 | #endif 53 | /* *INDENT-ON* */ 54 | 55 | #endif /* __LXW_VML_H__ */ 56 | -------------------------------------------------------------------------------- /Pods/libxlsxwriter/third_party/dtoa/emyg_dtoa.h: -------------------------------------------------------------------------------- 1 | /* emyg_dtoa.h 2 | ** Copyright (C) 2015 Doug Currie 3 | ** based on dtoa_milo.h 4 | ** Copyright (C) 2014 Milo Yip 5 | ** 6 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 7 | ** of this software and associated documentation files (the "Software"), to deal 8 | ** in the Software without restriction, including without limitation the rights 9 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | ** copies of the Software, and to permit persons to whom the Software is 11 | ** furnished to do so, subject to the following conditions: 12 | ** 13 | ** The above copyright notice and this permission notice shall be included in 14 | ** all copies or substantial portions of the Software. 15 | ** 16 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | ** THE SOFTWARE. 23 | */ 24 | 25 | /* Source from https://github.com/miloyip/dtoa-benchmark */ 26 | void emyg_dtoa (double value, char* buffer); 27 | -------------------------------------------------------------------------------- /Pods/libxlsxwriter/include/xlsxwriter/third_party/emyg_dtoa.h: -------------------------------------------------------------------------------- 1 | /* emyg_dtoa.h 2 | ** Copyright (C) 2015 Doug Currie 3 | ** based on dtoa_milo.h 4 | ** Copyright (C) 2014 Milo Yip 5 | ** 6 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 7 | ** of this software and associated documentation files (the "Software"), to deal 8 | ** in the Software without restriction, including without limitation the rights 9 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | ** copies of the Software, and to permit persons to whom the Software is 11 | ** furnished to do so, subject to the following conditions: 12 | ** 13 | ** The above copyright notice and this permission notice shall be included in 14 | ** all copies or substantial portions of the Software. 15 | ** 16 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | ** THE SOFTWARE. 23 | */ 24 | 25 | /* Source from https://github.com/miloyip/dtoa-benchmark */ 26 | void emyg_dtoa (double value, char* buffer); 27 | -------------------------------------------------------------------------------- /Pods/Sourceful/Sources/Model/SyntaxColorTheme.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SyntaxTheme.swift 3 | // SavannaKit 4 | // 5 | // Created by Louis D'hauwe on 24/01/2017. 6 | // Copyright © 2017 Silver Fox. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import CoreGraphics 11 | 12 | public struct LineNumbersStyle { 13 | 14 | public let font: Font 15 | public let textColor: Color 16 | 17 | public init(font: Font, textColor: Color) { 18 | self.font = font 19 | self.textColor = textColor 20 | } 21 | 22 | } 23 | 24 | public struct GutterStyle { 25 | 26 | public let backgroundColor: Color 27 | 28 | /// If line numbers are displayed, the gutter width adapts to fit all line numbers. 29 | /// This specifies the minimum width that the gutter should have at all times, 30 | /// regardless of any line numbers. 31 | public let minimumWidth: CGFloat 32 | 33 | public init(backgroundColor: Color, minimumWidth: CGFloat) { 34 | self.backgroundColor = backgroundColor 35 | self.minimumWidth = minimumWidth 36 | } 37 | } 38 | 39 | public protocol SyntaxColorTheme { 40 | 41 | /// Nil hides line numbers. 42 | var lineNumbersStyle: LineNumbersStyle? { get } 43 | 44 | var gutterStyle: GutterStyle { get } 45 | 46 | var font: Font { get } 47 | 48 | var backgroundColor: Color { get } 49 | 50 | func globalAttributes() -> [NSAttributedString.Key: Any] 51 | 52 | func attributes(for token: Token) -> [NSAttributedString.Key: Any] 53 | } 54 | -------------------------------------------------------------------------------- /Pods/Sourceful/Sources/SourceCodeRegexLexer.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SavannaKit+Swift.swift 3 | // SourceEditor 4 | // 5 | // Created by Louis D'hauwe on 24/07/2018. 6 | // Copyright © 2018 Silver Fox. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public protocol SourceCodeRegexLexer: RegexLexer { 12 | 13 | 14 | } 15 | 16 | extension RegexLexer { 17 | 18 | func regexGenerator(_ pattern: String, options: NSRegularExpression.Options = [], transformer: @escaping TokenTransformer) -> TokenGenerator? { 19 | 20 | guard let regex = try? NSRegularExpression(pattern: pattern, options: options) else { 21 | return nil 22 | } 23 | 24 | return .regex(RegexTokenGenerator(regularExpression: regex, tokenTransformer: transformer)) 25 | } 26 | 27 | } 28 | 29 | extension SourceCodeRegexLexer { 30 | 31 | func regexGenerator(_ pattern: String, options: NSRegularExpression.Options = [], tokenType: SourceCodeTokenType) -> TokenGenerator? { 32 | 33 | return regexGenerator(pattern, options: options, transformer: { (range) -> Token in 34 | return SimpleSourceCodeToken(type: tokenType, range: range) 35 | }) 36 | } 37 | 38 | func keywordGenerator(_ words: [String], tokenType: SourceCodeTokenType) -> TokenGenerator { 39 | 40 | return .keywords(KeywordTokenGenerator(keywords: words, tokenTransformer: { (range) -> Token in 41 | return SimpleSourceCodeToken(type: tokenType, range: range) 42 | })) 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /LibXlsxWriterSwiftSample/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // LibXlsxWriterSwiftSample 4 | // 5 | 6 | import UIKit 7 | 8 | @UIApplicationMain 9 | class AppDelegate: UIResponder, UIApplicationDelegate { 10 | 11 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 12 | // Override point for customization after application launch. 13 | return true 14 | } 15 | 16 | // MARK: UISceneSession Lifecycle 17 | 18 | func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { 19 | // Called when a new scene session is being created. 20 | // Use this method to select a configuration to create the new scene with. 21 | return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) 22 | } 23 | 24 | func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { 25 | // Called when the user discards a scene session. 26 | // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. 27 | // Use this method to release any resources that were specific to the discarded scenes, as they will not return. 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /LibXlsxWriterSwiftSample/Examples/dates_and_times02.swift: -------------------------------------------------------------------------------- 1 | // 2 | // dates_and_times02.swift 3 | // LibXlsxWriterSwiftSample 4 | // 5 | 6 | import Foundation 7 | import xlsxwriter 8 | 9 | class DatesAndTimes02{ 10 | func generate() -> URL { 11 | //A number to display as a date. 12 | var datetime = lxw_datetime(year: 2013, month: 2, day: 28, hour: 12, min: 0, sec: 0.0) 13 | 14 | let documentDirectory = try! FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor:nil, create:false) 15 | let fileURL = documentDirectory.appendingPathComponent("date_and_times02.xlsx") 16 | 17 | let workbook = workbook_new((fileURL.absoluteString.dropFirst(6) as NSString).fileSystemRepresentation) 18 | let worksheet = workbook_add_worksheet(workbook, nil) 19 | 20 | //Add a format with date formatting. 21 | let format = workbook_add_format(workbook) 22 | format_set_num_format(format, "mmm d yyyy hh:mm AM/PM") 23 | //Widen the first column to make the text clearer. 24 | worksheet_set_column(worksheet, 0, 0, 20, nil) 25 | //Write the datetime without formatting. 26 | worksheet_write_datetime(worksheet, 0, 0, &datetime, nil) // 41333.5 27 | //Write the datetime with formatting. 28 | worksheet_write_datetime(worksheet, 1, 0, &datetime, format) // Feb 28 2013 12:00 PM 29 | 30 | workbook_close(workbook) 31 | 32 | return fileURL 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Pods/Sourceful/Sources/Util/Types.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Types.swift 3 | // SavannaKit 4 | // 5 | // Created by Louis D'hauwe on 24/06/2017. 6 | // Copyright © 2017 Silver Fox. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | #if os(macOS) 12 | 13 | import AppKit 14 | 15 | public typealias View = NSView 16 | public typealias ViewController = NSViewController 17 | public typealias Window = NSWindow 18 | public typealias Control = NSControl 19 | public typealias TextView = NSTextView 20 | public typealias TextField = NSTextField 21 | public typealias Button = NSButton 22 | public typealias Font = NSFont 23 | public typealias Color = NSColor 24 | public typealias StackView = NSStackView 25 | public typealias Image = NSImage 26 | public typealias BezierPath = NSBezierPath 27 | public typealias ScrollView = NSScrollView 28 | public typealias Screen = NSScreen 29 | 30 | #else 31 | 32 | import UIKit 33 | 34 | public typealias View = UIView 35 | public typealias ViewController = UIViewController 36 | public typealias Window = UIWindow 37 | public typealias Control = UIControl 38 | public typealias TextView = UITextView 39 | public typealias TextField = UITextField 40 | public typealias Button = UIButton 41 | public typealias Font = UIFont 42 | public typealias Color = UIColor 43 | public typealias StackView = UIStackView 44 | public typealias Image = UIImage 45 | public typealias BezierPath = UIBezierPath 46 | public typealias ScrollView = UIScrollView 47 | public typealias Screen = UIScreen 48 | 49 | #endif 50 | 51 | -------------------------------------------------------------------------------- /LibXlsxWriterSwiftSample/Examples/dates_and_times01.swift: -------------------------------------------------------------------------------- 1 | // 2 | // dates_and_times01.swift 3 | // LibXlsxWriterSwiftSample 4 | // 5 | 6 | import Foundation 7 | import xlsxwriter 8 | 9 | class DatesAndTimes01{ 10 | func generate() -> URL { 11 | //A number to display as a date. 12 | let number = 41333.5 13 | 14 | let documentDirectory = try! FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor:nil, create:false) 15 | let fileURL = documentDirectory.appendingPathComponent("date_and_times01.xlsx") 16 | 17 | let workbook = workbook_new((fileURL.absoluteString.dropFirst(6) as NSString).fileSystemRepresentation) 18 | let worksheet = workbook_add_worksheet(workbook, nil) 19 | //Add a format with date formatting. 20 | let format = workbook_add_format(workbook) 21 | format_set_num_format(format, "mmm d yyyy hh:mm AM/PM") 22 | //Widen the first column to make the text clearer. 23 | worksheet_set_column(worksheet, 0, 0, 20, nil) 24 | //Write the number without formatting. 25 | worksheet_write_number(worksheet, 0, 0, number, nil) // 41333.5 26 | /* Write the number with formatting. Note: the worksheet_write_datetime() 27 | * function is preferable for writing dates and times. This is for 28 | * demonstration purposes only. 29 | */ 30 | worksheet_write_number(worksheet, 1, 0, number, format) // Feb 28 2013 12:00 PM 31 | 32 | workbook_close(workbook) 33 | 34 | return fileURL 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Pods/libxlsxwriter/third_party/md5/md5.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This is an OpenSSL-compatible implementation of the RSA Data Security, Inc. 3 | * MD5 Message-Digest Algorithm (RFC 1321). 4 | * 5 | * Homepage: 6 | * http://openwall.info/wiki/people/solar/software/public-domain-source-code/md5 7 | * 8 | * Author: 9 | * Alexander Peslyak, better known as Solar Designer 10 | * 11 | * This software was written by Alexander Peslyak in 2001. No copyright is 12 | * claimed, and the software is hereby placed in the public domain. 13 | * In case this attempt to disclaim copyright and place the software in the 14 | * public domain is deemed null and void, then the software is 15 | * Copyright (c) 2001 Alexander Peslyak and it is hereby released to the 16 | * general public under the following terms: 17 | * 18 | * Redistribution and use in source and binary forms, with or without 19 | * modification, are permitted. 20 | * 21 | * There's ABSOLUTELY NO WARRANTY, express or implied. 22 | * 23 | * See md5.c for more information. 24 | */ 25 | 26 | #ifdef HAVE_OPENSSL 27 | #include 28 | #elif !defined(_MD5_H) 29 | #define _MD5_H 30 | 31 | /* Any 32-bit or wider unsigned integer data type will do */ 32 | typedef unsigned int MD5_u32plus; 33 | 34 | typedef struct { 35 | MD5_u32plus lo, hi; 36 | MD5_u32plus a, b, c, d; 37 | unsigned char buffer[64]; 38 | MD5_u32plus block[16]; 39 | } MD5_CTX; 40 | 41 | extern void MD5_Init(MD5_CTX *ctx); 42 | extern void MD5_Update(MD5_CTX *ctx, const void *data, unsigned long size); 43 | extern void MD5_Final(unsigned char *result, MD5_CTX *ctx); 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /Pods/libxlsxwriter/include/xlsxwriter/third_party/md5.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This is an OpenSSL-compatible implementation of the RSA Data Security, Inc. 3 | * MD5 Message-Digest Algorithm (RFC 1321). 4 | * 5 | * Homepage: 6 | * http://openwall.info/wiki/people/solar/software/public-domain-source-code/md5 7 | * 8 | * Author: 9 | * Alexander Peslyak, better known as Solar Designer 10 | * 11 | * This software was written by Alexander Peslyak in 2001. No copyright is 12 | * claimed, and the software is hereby placed in the public domain. 13 | * In case this attempt to disclaim copyright and place the software in the 14 | * public domain is deemed null and void, then the software is 15 | * Copyright (c) 2001 Alexander Peslyak and it is hereby released to the 16 | * general public under the following terms: 17 | * 18 | * Redistribution and use in source and binary forms, with or without 19 | * modification, are permitted. 20 | * 21 | * There's ABSOLUTELY NO WARRANTY, express or implied. 22 | * 23 | * See md5.c for more information. 24 | */ 25 | 26 | #ifdef HAVE_OPENSSL 27 | #include 28 | #elif !defined(_MD5_H) 29 | #define _MD5_H 30 | 31 | /* Any 32-bit or wider unsigned integer data type will do */ 32 | typedef unsigned int MD5_u32plus; 33 | 34 | typedef struct { 35 | MD5_u32plus lo, hi; 36 | MD5_u32plus a, b, c, d; 37 | unsigned char buffer[64]; 38 | MD5_u32plus block[16]; 39 | } MD5_CTX; 40 | 41 | extern void MD5_Init(MD5_CTX *ctx); 42 | extern void MD5_Update(MD5_CTX *ctx, const void *data, unsigned long size); 43 | extern void MD5_Final(unsigned char *result, MD5_CTX *ctx); 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /LibXlsxWriterSwiftSample/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /LibXlsxWriterSwiftSample/Examples/format_font.swift: -------------------------------------------------------------------------------- 1 | // 2 | // format_font.swift 3 | // LibXlsxWriterSwiftSample 4 | // 5 | 6 | import Foundation 7 | import xlsxwriter 8 | 9 | class FormatFont{ 10 | func generate() -> URL { 11 | let documentDirectory = try! FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor:nil, create:false) 12 | let fileURL = documentDirectory.appendingPathComponent("format_font.xlsx") 13 | 14 | let workbook = workbook_new((fileURL.absoluteString.dropFirst(6) as NSString).fileSystemRepresentation) 15 | let worksheet = workbook_add_worksheet(workbook, nil) 16 | //Widen the first column to make the text clearer 17 | worksheet_set_column(worksheet, 0, 0, 20, nil) 18 | //Add some formats. 19 | let format1 = workbook_add_format(workbook) 20 | let format2 = workbook_add_format(workbook) 21 | let format3 = workbook_add_format(workbook) 22 | //Set the bold property for format 1 23 | format_set_bold(format1) 24 | //Set the italic property for format 2 25 | format_set_italic(format2) 26 | //Set the bold and italic properties for format 3 27 | format_set_bold (format3) 28 | format_set_italic(format3) 29 | //Write some formatted strings 30 | worksheet_write_string(worksheet, 0, 0, "This is bold", format1) 31 | worksheet_write_string(worksheet, 1, 0, "This is italic", format2) 32 | worksheet_write_string(worksheet, 2, 0, "Bold and italic", format3) 33 | //Close the workbook, save the file and free any memory 34 | workbook_close(workbook) 35 | 36 | return fileURL 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /LibXlsxWriterSwiftSample/Views/ItemCodePage.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ItemCodePage.swift 3 | // LibXlsxWriterSwiftSample 4 | // 5 | 6 | import UIKit 7 | import Sourceful 8 | 9 | class ItemCodePage: UIViewController{ 10 | var item: Example! 11 | let lexer = SwiftLexer() 12 | 13 | override func viewDidLoad() { 14 | super.viewDidLoad() 15 | 16 | self.title = "Code" 17 | 18 | let codeArea = SyntaxTextView() 19 | codeArea.theme = DefaultSourceCodeTheme() 20 | codeArea.delegate = self 21 | codeArea.translatesAutoresizingMaskIntoConstraints = false 22 | 23 | self.view.addSubview(codeArea) 24 | 25 | NSLayoutConstraint.activate([ 26 | codeArea.leftAnchor.constraint(equalTo: self.view.safeAreaLayoutGuide.leftAnchor, constant: 5), 27 | codeArea.topAnchor.constraint(equalTo: self.view.safeAreaLayoutGuide.topAnchor), 28 | codeArea.rightAnchor.constraint(equalTo: self.view.safeAreaLayoutGuide.rightAnchor, constant: 5), 29 | codeArea.bottomAnchor.constraint(equalTo: self.view.safeAreaLayoutGuide.bottomAnchor), 30 | ]) 31 | 32 | codeArea.insertText(item.code) 33 | } 34 | 35 | override func viewWillAppear(_ animated: Bool) { 36 | 37 | } 38 | } 39 | 40 | extension ItemCodePage: SyntaxTextViewDelegate { 41 | 42 | func didChangeText(_ syntaxTextView: SyntaxTextView) { 43 | 44 | 45 | } 46 | 47 | func didChangeSelectedRange(_ syntaxTextView: SyntaxTextView, selectedRange: NSRange) { 48 | 49 | 50 | } 51 | 52 | func lexerForSource(_ source: String) -> Lexer { 53 | return self.lexer 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Pods/Sourceful/Sources/Themes/DefaultSourceCodeTheme.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DefaultSourceCodeTheme.swift 3 | // SourceEditor 4 | // 5 | // Created by Louis D'hauwe on 24/07/2018. 6 | // Copyright © 2018 Silver Fox. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public struct DefaultSourceCodeTheme: SourceCodeTheme { 12 | 13 | public init() { 14 | 15 | } 16 | 17 | private static var lineNumbersColor: Color { 18 | return Color(red: 100/255, green: 100/255, blue: 100/255, alpha: 1.0) 19 | } 20 | 21 | public let lineNumbersStyle: LineNumbersStyle? = LineNumbersStyle(font: Font(name: "Menlo", size: 16)!, textColor: lineNumbersColor) 22 | 23 | public let gutterStyle: GutterStyle = GutterStyle(backgroundColor: Color(red: 21/255.0, green: 22/255, blue: 31/255, alpha: 1.0), minimumWidth: 32) 24 | 25 | public let font = Font(name: "Menlo", size: 15)! 26 | 27 | public let backgroundColor = Color(red: 31/255.0, green: 32/255, blue: 41/255, alpha: 1.0) 28 | 29 | public func color(for syntaxColorType: SourceCodeTokenType) -> Color { 30 | 31 | switch syntaxColorType { 32 | case .plain: 33 | return .white 34 | 35 | case .number: 36 | return Color(red: 116/255, green: 109/255, blue: 176/255, alpha: 1.0) 37 | 38 | case .string: 39 | return Color(red: 211/255, green: 35/255, blue: 46/255, alpha: 1.0) 40 | 41 | case .identifier: 42 | return Color(red: 20/255, green: 156/255, blue: 146/255, alpha: 1.0) 43 | 44 | case .keyword: 45 | return Color(red: 215/255, green: 0, blue: 143/255, alpha: 1.0) 46 | 47 | case .comment: 48 | return Color(red: 69.0/255.0, green: 187.0/255.0, blue: 62.0/255.0, alpha: 1.0) 49 | 50 | case .editorPlaceholder: 51 | return backgroundColor 52 | } 53 | 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /LibXlsxWriterSwiftSample/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /LibXlsxWriterSwiftSample/Examples/tutorial1.swift: -------------------------------------------------------------------------------- 1 | // 2 | // tutorial1.swift 3 | // LibXlsxWriterSwiftSample 4 | // 5 | import Foundation 6 | import xlsxwriter 7 | 8 | class Tutorial1{ 9 | let expenses = [ 10 | Expense(item: "Rent", cost: 1000), 11 | Expense(item: "Gas", cost: 100), 12 | Expense(item: "Food", cost: 300), 13 | Expense(item: "Gym", cost: 50), 14 | ] 15 | 16 | func generate() -> URL { 17 | let documentDirectory = try! FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor:nil, create:false) 18 | let fileURL = documentDirectory.appendingPathComponent("tutorial01.xlsx") 19 | 20 | //Create a new workbook. 21 | //Ditch first 6 characters, because they are of the form file:// 22 | let workbook = workbook_new((fileURL.absoluteString.dropFirst(6) as NSString).fileSystemRepresentation) 23 | 24 | let worksheet = workbook_add_worksheet(workbook, nil) 25 | //Start from the first cell. Rows and columns are zero indexed. 26 | var row = 0 27 | let col = 0 28 | //Iterate over the data and write it out element by element. 29 | for row in (0...3).reversed() { 30 | worksheet_write_string(worksheet, lxw_row_t(row), lxw_col_t(col), expenses[row].item, nil) 31 | worksheet_write_number(worksheet, lxw_row_t(row), lxw_col_t(col + 1), expenses[row].cost, nil) 32 | } 33 | row = 4 34 | //Write a total using a formula. 35 | worksheet_write_string (worksheet, lxw_row_t(row), lxw_col_t(col), "Total", nil) 36 | worksheet_write_formula(worksheet, lxw_row_t(row), lxw_col_t(col + 1), "=SUM(B1:B4)", nil) 37 | workbook_close(workbook) 38 | return fileURL 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Pods/Sourceful/README.md: -------------------------------------------------------------------------------- 1 | 2 |

3 | Sourceful logo 4 |

5 | 6 |

7 | 8 | 9 | 10 | Twitter: @twostraws 11 | 12 |

13 | 14 | Sourceful is a syntax text editor for iOS and macOS, providing subclasses of `UITextView` and `NSTextView` that offer live syntax highlighting as you type. Right now it includes syntax highlighting support for Swift and Python, but it's easy to add your own. 15 | 16 | This project is a combination of two projects from Louis D’hauwe: [SavannaKit](https://github.com/louisdh/savannakit) and [Source Editor](https://github.com/louisdh/source-editor). 17 | 18 | Both of those projects were archived when Louis joined Apple, which meant they haven’t been updated since Swift 4.1. This causes a variety of pain points with Cocoapods, so Sourceful is designed to avoid them entirely: it combines both those projects into one repository, and is fully updated for modern versions of Swift. 19 | 20 | 21 | ## Credits 22 | 23 | SavannaKit and SourceEditor were designed by Louis D’hauwe. Sourceful was built by combining those two and updating them to modern Swift, and is maintained by Paul Hudson. 24 | 25 | Sourceful is licensed under the MIT license; see LICENSE for more information. 26 | 27 | Swift, the Swift logo, Xcode, Instruments, Cocoa Touch, Touch ID, AirDrop, iBeacon, iPhone, iPad, Safari, App Store, watchOS, tvOS, Mac and macOS are trademarks of Apple Inc., registered in the U.S. and other countries. 28 | -------------------------------------------------------------------------------- /Pods/Sourceful/Sources/Languages/Python3Lexer.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Python3Lexer.swift 3 | // SourceEditor 4 | // 5 | // Created by Stefan Wijnja on 27/07/2018. 6 | // Based on SwiftLexer.swift by Louis D'hauwe. 7 | // Copyright © 2018 Silver Fox. All rights reserved. 8 | // 9 | 10 | import Foundation 11 | 12 | public class Python3Lexer: SourceCodeRegexLexer { 13 | 14 | public init() { 15 | 16 | } 17 | 18 | lazy var generators: [TokenGenerator] = { 19 | 20 | var generators = [TokenGenerator?]() 21 | // Functions 22 | generators.append(regexGenerator("\\bprint(?=\\()", tokenType: .identifier)) 23 | 24 | generators.append(regexGenerator("(?<=[^a-zA-Z])\\d+", tokenType: .number)) 25 | 26 | generators.append(regexGenerator("\\.\\w+", tokenType: .identifier)) 27 | 28 | let keywords = "False None True and as assert break class continue def del elif else except finally for from global if import in is lambda nonlocal not or pass raise return try while with yield".components(separatedBy: " ") 29 | 30 | generators.append(keywordGenerator(keywords, tokenType: .keyword)) 31 | 32 | // Line comment 33 | generators.append(regexGenerator("#(.*)", tokenType: .comment)) 34 | 35 | // Block comment or multi-line string literal 36 | generators.append(regexGenerator("(\"\"\".*\"\"\")|(\'\'\'.*\'\'\')", options: [.dotMatchesLineSeparators], tokenType: .comment)) 37 | 38 | // Single-line string literal 39 | generators.append(regexGenerator("('.*')|(\".*\")", tokenType: .string)) 40 | 41 | // Editor placeholder 42 | var editorPlaceholderPattern = "(<#)[^\"\\n]*" 43 | editorPlaceholderPattern += "(#>)" 44 | generators.append(regexGenerator(editorPlaceholderPattern, tokenType: .editorPlaceholder)) 45 | 46 | return generators.compactMap( { $0 }) 47 | }() 48 | 49 | public func generators(source: String) -> [TokenGenerator] { 50 | return generators 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /Pods/libxlsxwriter/include/xlsxwriter/app.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libxlsxwriter 3 | * 4 | * Copyright 2014-2021, John McNamara, jmcnamara@cpan.org. See LICENSE.txt. 5 | * 6 | * app - A libxlsxwriter library for creating Excel XLSX app files. 7 | * 8 | */ 9 | #ifndef __LXW_APP_H__ 10 | #define __LXW_APP_H__ 11 | 12 | #include 13 | #include 14 | #include "workbook.h" 15 | #include "common.h" 16 | 17 | /* Define the queue.h TAILQ structs for the App structs. */ 18 | STAILQ_HEAD(lxw_heading_pairs, lxw_heading_pair); 19 | STAILQ_HEAD(lxw_part_names, lxw_part_name); 20 | 21 | typedef struct lxw_heading_pair { 22 | 23 | char *key; 24 | char *value; 25 | 26 | STAILQ_ENTRY (lxw_heading_pair) list_pointers; 27 | 28 | } lxw_heading_pair; 29 | 30 | typedef struct lxw_part_name { 31 | 32 | char *name; 33 | 34 | STAILQ_ENTRY (lxw_part_name) list_pointers; 35 | 36 | } lxw_part_name; 37 | 38 | /* Struct to represent an App object. */ 39 | typedef struct lxw_app { 40 | 41 | FILE *file; 42 | 43 | struct lxw_heading_pairs *heading_pairs; 44 | struct lxw_part_names *part_names; 45 | lxw_doc_properties *properties; 46 | 47 | uint32_t num_heading_pairs; 48 | uint32_t num_part_names; 49 | uint8_t doc_security; 50 | 51 | } lxw_app; 52 | 53 | 54 | /* *INDENT-OFF* */ 55 | #ifdef __cplusplus 56 | extern "C" { 57 | #endif 58 | /* *INDENT-ON* */ 59 | 60 | lxw_app *lxw_app_new(void); 61 | void lxw_app_free(lxw_app *app); 62 | void lxw_app_assemble_xml_file(lxw_app *self); 63 | void lxw_app_add_part_name(lxw_app *self, const char *name); 64 | void lxw_app_add_heading_pair(lxw_app *self, const char *key, 65 | const char *value); 66 | 67 | /* Declarations required for unit testing. */ 68 | #ifdef TESTING 69 | 70 | STATIC void _app_xml_declaration(lxw_app *self); 71 | 72 | #endif /* TESTING */ 73 | 74 | /* *INDENT-OFF* */ 75 | #ifdef __cplusplus 76 | } 77 | #endif 78 | /* *INDENT-ON* */ 79 | 80 | #endif /* __LXW_APP_H__ */ 81 | -------------------------------------------------------------------------------- /LibXlsxWriterSwiftSample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UIApplicationSceneManifest 24 | 25 | UIApplicationSupportsMultipleScenes 26 | 27 | UISceneConfigurations 28 | 29 | UIWindowSceneSessionRoleApplication 30 | 31 | 32 | UISceneConfigurationName 33 | Default Configuration 34 | UISceneDelegateClassName 35 | $(PRODUCT_MODULE_NAME).SceneDelegate 36 | 37 | 38 | 39 | 40 | UILaunchStoryboardName 41 | LaunchScreen 42 | UIRequiredDeviceCapabilities 43 | 44 | armv7 45 | 46 | UISupportedInterfaceOrientations 47 | 48 | UIInterfaceOrientationPortrait 49 | UIInterfaceOrientationLandscapeLeft 50 | UIInterfaceOrientationLandscapeRight 51 | UIInterfaceOrientationPortraitUpsideDown 52 | 53 | UISupportedInterfaceOrientations~ipad 54 | 55 | UIInterfaceOrientationPortrait 56 | UIInterfaceOrientationPortraitUpsideDown 57 | UIInterfaceOrientationLandscapeLeft 58 | UIInterfaceOrientationLandscapeRight 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /Pods/libxlsxwriter/include/xlsxwriter/comment.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libxlsxwriter 3 | * 4 | * Copyright 2014-2021, John McNamara, jmcnamara@cpan.org. See LICENSE.txt. 5 | * 6 | * comment - A libxlsxwriter library for creating Excel XLSX comment files. 7 | * 8 | */ 9 | #ifndef __LXW_COMMENT_H__ 10 | #define __LXW_COMMENT_H__ 11 | 12 | #include 13 | 14 | #include "common.h" 15 | #include "worksheet.h" 16 | 17 | /* Define the tree.h RB structs for the red-black head types. */ 18 | RB_HEAD(lxw_author_ids, lxw_author_id); 19 | 20 | /* 21 | * Struct to represent a comment object. 22 | */ 23 | typedef struct lxw_comment { 24 | 25 | FILE *file; 26 | struct lxw_comment_objs *comment_objs; 27 | struct lxw_author_ids *author_ids; 28 | char *comment_author; 29 | uint32_t author_id; 30 | 31 | } lxw_comment; 32 | 33 | /* Struct to an author id */ 34 | typedef struct lxw_author_id { 35 | uint32_t id; 36 | char *author; 37 | 38 | RB_ENTRY (lxw_author_id) tree_pointers; 39 | } lxw_author_id; 40 | 41 | #define LXW_RB_GENERATE_AUTHOR_IDS(name, type, field, cmp) \ 42 | RB_GENERATE_INSERT_COLOR(name, type, field, static) \ 43 | RB_GENERATE_REMOVE_COLOR(name, type, field, static) \ 44 | RB_GENERATE_INSERT(name, type, field, cmp, static) \ 45 | RB_GENERATE_REMOVE(name, type, field, static) \ 46 | RB_GENERATE_FIND(name, type, field, cmp, static) \ 47 | RB_GENERATE_NEXT(name, type, field, static) \ 48 | RB_GENERATE_MINMAX(name, type, field, static) \ 49 | /* Add unused struct to allow adding a semicolon */ \ 50 | struct lxw_rb_generate_author_ids{int unused;} 51 | 52 | 53 | /* *INDENT-OFF* */ 54 | #ifdef __cplusplus 55 | extern "C" { 56 | #endif 57 | /* *INDENT-ON* */ 58 | 59 | lxw_comment *lxw_comment_new(void); 60 | void lxw_comment_free(lxw_comment *comment); 61 | void lxw_comment_assemble_xml_file(lxw_comment *self); 62 | 63 | /* Declarations required for unit testing. */ 64 | #ifdef TESTING 65 | 66 | STATIC void _comment_xml_declaration(lxw_comment *self); 67 | 68 | #endif /* TESTING */ 69 | 70 | /* *INDENT-OFF* */ 71 | #ifdef __cplusplus 72 | } 73 | #endif 74 | /* *INDENT-ON* */ 75 | 76 | #endif /* __LXW_COMMENT_H__ */ 77 | -------------------------------------------------------------------------------- /LibXlsxWriterSwiftSample/Examples/demo.swift: -------------------------------------------------------------------------------- 1 | // 2 | // demo.swift 3 | // LibXlsxWriterSwiftSample 4 | // 5 | import Foundation 6 | import UIKit 7 | import xlsxwriter 8 | 9 | class Demo{ 10 | func generate() -> URL { 11 | let documentDirectory = try! FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor:nil, create:false) 12 | let fileURL = documentDirectory.appendingPathComponent("demo.xlsx") 13 | 14 | //Create a new workbook. 15 | //Ditch first 6 characters, because they are of the form file:// 16 | let workbook = workbook_new((fileURL.absoluteString.dropFirst(6) as NSString).fileSystemRepresentation) 17 | let worksheet = workbook_add_worksheet(workbook, nil) 18 | //Add a format. 19 | let format = workbook_add_format(workbook) 20 | //Set the bold property for the format 21 | format_set_bold(format) 22 | //Change the column width for clarity 23 | worksheet_set_column(worksheet, 0, 0, 20, nil) 24 | //Write some simple text 25 | worksheet_write_string(worksheet, 0, 0, "Hello", nil) 26 | //Text with formatting 27 | worksheet_write_string(worksheet, 1, 0, "World", format) 28 | //Write some numbers 29 | worksheet_write_number(worksheet, 2, 0, 123, nil) 30 | worksheet_write_number(worksheet, 3, 0, 123.456, nil) 31 | //Insert an image 32 | var imageBuffer = getArrayOfBytesFromImage(imageData: (UIImage(named: "logo")?.jpegData(compressionQuality: .greatestFiniteMagnitude)!)! as NSData) 33 | worksheet_insert_image_buffer(worksheet, 1, 2, &imageBuffer, imageBuffer.count) 34 | workbook_close(workbook) 35 | 36 | return fileURL 37 | } 38 | 39 | func getArrayOfBytesFromImage(imageData:NSData) -> [UInt8] 40 | { 41 | //Determine array size 42 | let count = imageData.length / MemoryLayout.size(ofValue: UInt8()) 43 | //Create an array of the appropriate size 44 | var bytes = [UInt8](repeating: 0, count: count) 45 | //Copy image data as bytes into the array 46 | imageData.getBytes(&bytes, length:count * MemoryLayout.size(ofValue: UInt8())) 47 | 48 | return bytes 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Pods/libxlsxwriter/include/xlsxwriter/relationships.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libxlsxwriter 3 | * 4 | * Copyright 2014-2021, John McNamara, jmcnamara@cpan.org. See LICENSE.txt. 5 | * 6 | * relationships - A libxlsxwriter library for creating Excel XLSX 7 | * relationships files. 8 | * 9 | */ 10 | #ifndef __LXW_RELATIONSHIPS_H__ 11 | #define __LXW_RELATIONSHIPS_H__ 12 | 13 | #include 14 | 15 | #include "common.h" 16 | 17 | /* Define the queue.h STAILQ structs for the generic data structs. */ 18 | STAILQ_HEAD(lxw_rel_tuples, lxw_rel_tuple); 19 | 20 | typedef struct lxw_rel_tuple { 21 | 22 | char *type; 23 | char *target; 24 | char *target_mode; 25 | 26 | STAILQ_ENTRY (lxw_rel_tuple) list_pointers; 27 | 28 | } lxw_rel_tuple; 29 | 30 | /* 31 | * Struct to represent a relationships. 32 | */ 33 | typedef struct lxw_relationships { 34 | 35 | FILE *file; 36 | 37 | uint32_t rel_id; 38 | struct lxw_rel_tuples *relationships; 39 | 40 | } lxw_relationships; 41 | 42 | 43 | 44 | /* *INDENT-OFF* */ 45 | #ifdef __cplusplus 46 | extern "C" { 47 | #endif 48 | /* *INDENT-ON* */ 49 | 50 | lxw_relationships *lxw_relationships_new(void); 51 | void lxw_free_relationships(lxw_relationships *relationships); 52 | void lxw_relationships_assemble_xml_file(lxw_relationships *self); 53 | 54 | void lxw_add_document_relationship(lxw_relationships *self, const char *type, 55 | const char *target); 56 | void lxw_add_package_relationship(lxw_relationships *self, const char *type, 57 | const char *target); 58 | void lxw_add_ms_package_relationship(lxw_relationships *self, 59 | const char *type, const char *target); 60 | void lxw_add_worksheet_relationship(lxw_relationships *self, const char *type, 61 | const char *target, 62 | const char *target_mode); 63 | 64 | /* Declarations required for unit testing. */ 65 | #ifdef TESTING 66 | 67 | STATIC void _relationships_xml_declaration(lxw_relationships *self); 68 | 69 | #endif /* TESTING */ 70 | 71 | /* *INDENT-OFF* */ 72 | #ifdef __cplusplus 73 | } 74 | #endif 75 | /* *INDENT-ON* */ 76 | 77 | #endif /* __LXW_RELATIONSHIPS_H__ */ 78 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/ferdinandschaffler.xcuserdatad/xcschemes/libxlsxwriter.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 50 | 51 | 53 | 54 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/michaelschaeffler.xcuserdatad/xcschemes/libxlsxwriter.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 50 | 51 | 53 | 54 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /Pods/libxlsxwriter/include/xlsxwriter/hash_table.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libxlsxwriter 3 | * 4 | * Copyright 2014-2021, John McNamara, jmcnamara@cpan.org. See LICENSE.txt. 5 | * 6 | * hash_table - Hash table functions for libxlsxwriter. 7 | * 8 | */ 9 | 10 | #ifndef __LXW_HASH_TABLE_H__ 11 | #define __LXW_HASH_TABLE_H__ 12 | 13 | #include "common.h" 14 | 15 | /* Macro to loop over hash table elements in insertion order. */ 16 | #define LXW_FOREACH_ORDERED(elem, hash_table) \ 17 | STAILQ_FOREACH((elem), (hash_table)->order_list, lxw_hash_order_pointers) 18 | 19 | /* List declarations. */ 20 | STAILQ_HEAD(lxw_hash_order_list, lxw_hash_element); 21 | SLIST_HEAD(lxw_hash_bucket_list, lxw_hash_element); 22 | 23 | /* LXW_HASH hash table struct. */ 24 | typedef struct lxw_hash_table { 25 | uint32_t num_buckets; 26 | uint32_t used_buckets; 27 | uint32_t unique_count; 28 | uint8_t free_key; 29 | uint8_t free_value; 30 | 31 | struct lxw_hash_order_list *order_list; 32 | struct lxw_hash_bucket_list **buckets; 33 | } lxw_hash_table; 34 | 35 | /* 36 | * LXW_HASH table element struct. 37 | * 38 | * The hash elements contain pointers to allow them to be stored in 39 | * lists in the the hash table buckets and also pointers to track the 40 | * insertion order in a separate list. 41 | */ 42 | typedef struct lxw_hash_element { 43 | void *key; 44 | void *value; 45 | 46 | STAILQ_ENTRY (lxw_hash_element) lxw_hash_order_pointers; 47 | SLIST_ENTRY (lxw_hash_element) lxw_hash_list_pointers; 48 | } lxw_hash_element; 49 | 50 | 51 | /* *INDENT-OFF* */ 52 | #ifdef __cplusplus 53 | extern "C" { 54 | #endif 55 | /* *INDENT-ON* */ 56 | 57 | lxw_hash_element *lxw_hash_key_exists(lxw_hash_table *lxw_hash, void *key, 58 | size_t key_len); 59 | lxw_hash_element *lxw_insert_hash_element(lxw_hash_table *lxw_hash, void *key, 60 | void *value, size_t key_len); 61 | lxw_hash_table *lxw_hash_new(uint32_t num_buckets, uint8_t free_key, 62 | uint8_t free_value); 63 | void lxw_hash_free(lxw_hash_table *lxw_hash); 64 | 65 | /* Declarations required for unit testing. */ 66 | #ifdef TESTING 67 | 68 | #endif 69 | 70 | /* *INDENT-OFF* */ 71 | #ifdef __cplusplus 72 | } 73 | #endif 74 | /* *INDENT-ON* */ 75 | 76 | #endif /* __LXW_HASH_TABLE_H__ */ 77 | -------------------------------------------------------------------------------- /LibXlsxWriterSwiftSample/Examples/tutorial2.swift: -------------------------------------------------------------------------------- 1 | // 2 | // tutorial2.swift 3 | // LibXlsxWriterSwiftSample 4 | // 5 | import Foundation 6 | import xlsxwriter 7 | 8 | class Tutorial2{ 9 | let expenses = [ 10 | Expense(item: "Rent", cost: 1000), 11 | Expense(item: "Gas", cost: 100), 12 | Expense(item: "Food", cost: 300), 13 | Expense(item: "Gym", cost: 50), 14 | ] 15 | 16 | func generate() -> URL { 17 | let documentDirectory = try! FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor:nil, create:false) 18 | let fileURL = documentDirectory.appendingPathComponent("tutorial02.xlsx") 19 | 20 | //Create a new workbook. 21 | //Ditch first 6 characters, because they are of the form file:// 22 | let workbook = workbook_new((fileURL.absoluteString.dropFirst(6) as NSString).fileSystemRepresentation) 23 | 24 | let worksheet = workbook_add_worksheet(workbook, nil) 25 | 26 | //Add a bold format to use to highlight cells 27 | let bold = workbook_add_format(workbook) 28 | format_set_bold(bold); 29 | //Add a number format for cells with money. 30 | let money = workbook_add_format(workbook) 31 | format_set_num_format(money, "$#,##0") 32 | 33 | //Write some data header. 34 | worksheet_write_string(worksheet, 0, 0, "Item", bold) 35 | worksheet_write_string(worksheet, 0, 1, "Cost", bold) 36 | 37 | //Start from the first cell. Rows and columns are zero indexed. 38 | var row = 0 39 | let col = 0 40 | //Iterate over the data and write it out element by element. 41 | for row in (0...3).reversed() { 42 | //Write from the first cell below the headers. 43 | worksheet_write_string(worksheet, lxw_row_t(row+1), lxw_col_t(col), expenses[row].item, nil) 44 | worksheet_write_number(worksheet, lxw_row_t(row+1), lxw_col_t(col + 1), expenses[row].cost, money) 45 | } 46 | row = 5 47 | //Write a total using a formula. 48 | worksheet_write_string (worksheet, lxw_row_t(row), lxw_col_t(col), "Total", bold) 49 | worksheet_write_formula(worksheet, lxw_row_t(row), lxw_col_t(col + 1), "=SUM(B2:B5)", money) 50 | workbook_close(workbook) 51 | return fileURL 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/ferdinandschaffler.xcuserdatad/xcschemes/Pods-LibXlsxWriterSwiftSample.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 50 | 51 | 53 | 54 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/michaelschaeffler.xcuserdatad/xcschemes/Pods-LibXlsxWriterSwiftSample.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 50 | 51 | 53 | 54 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /Pods/libxlsxwriter/third_party/tmpfileplus/tmpfileplus.h: -------------------------------------------------------------------------------- 1 | /* $Id: tmpfileplus.h $ */ 2 | /* 3 | * $Date: 2016-06-01 03:31Z $ 4 | * $Revision: 2.0.0 $ 5 | * $Author: dai $ 6 | */ 7 | 8 | /* 9 | * This Source Code Form is subject to the terms of the Mozilla Public 10 | * License, v. 2.0. If a copy of the MPL was not distributed with this 11 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. 12 | * 13 | * Copyright (c) 2012-16 David Ireland, DI Management Services Pty Ltd 14 | * . 15 | */ 16 | 17 | #if _MSC_VER > 1000 18 | #pragma once 19 | #endif 20 | 21 | #ifndef TMPFILEPLUS_H_ 22 | #define TMPFILEPLUS_H_ 23 | 24 | #include 25 | 26 | /** Create a unique temporary file. 27 | @param dir (optional) directory to create file. If NULL use default TMP directory. 28 | @param prefix (optional) prefix for file name. If NULL use "tmp.". 29 | @param pathname (optional) pointer to a buffer to receive the temp filename. 30 | Allocated using `malloc()`; user to free. Ignored if NULL. 31 | @param keep If `keep` is nonzero and `pathname` is not NULL, then keep the file after closing. 32 | Otherwise file is automatically deleted when closed. 33 | @return Pointer to stream opened in binary read/write (w+b) mode, or a null pointer on error. 34 | @exception ENOMEM Not enough memory to allocate filename. 35 | */ 36 | FILE *tmpfileplus(const char *dir, const char *prefix, char **pathname, int keep); 37 | 38 | 39 | /** Create a unique temporary file with filename stored in a fixed-length buffer. 40 | @param dir (optional) directory to create file. If NULL use default directory. 41 | @param prefix (optional) prefix for file name. If NULL use "tmp.". 42 | @param pathnamebuf (optional) buffer to receive full pathname of temporary file. Ignored if NULL. 43 | @param pathsize Size of buffer to receive filename and its terminating null character. 44 | @param keep If `keep` is nonzero and `pathname` is not NULL, then keep the file after closing. 45 | Otherwise file is automatically deleted when closed. 46 | @return Pointer to stream opened in binary read/write (w+b) mode, or a null pointer on error. 47 | @exception E2BIG Resulting filename is too big for the buffer `pathnamebuf`. 48 | */ 49 | FILE *tmpfileplus_f(const char *dir, const char *prefix, char *pathnamebuf, size_t pathsize, int keep); 50 | 51 | #define TMPFILE_KEEP 1 52 | 53 | #endif /* end TMPFILEPLUS_H_ */ 54 | -------------------------------------------------------------------------------- /Pods/libxlsxwriter/include/xlsxwriter/third_party/tmpfileplus.h: -------------------------------------------------------------------------------- 1 | /* $Id: tmpfileplus.h $ */ 2 | /* 3 | * $Date: 2016-06-01 03:31Z $ 4 | * $Revision: 2.0.0 $ 5 | * $Author: dai $ 6 | */ 7 | 8 | /* 9 | * This Source Code Form is subject to the terms of the Mozilla Public 10 | * License, v. 2.0. If a copy of the MPL was not distributed with this 11 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. 12 | * 13 | * Copyright (c) 2012-16 David Ireland, DI Management Services Pty Ltd 14 | * . 15 | */ 16 | 17 | #if _MSC_VER > 1000 18 | #pragma once 19 | #endif 20 | 21 | #ifndef TMPFILEPLUS_H_ 22 | #define TMPFILEPLUS_H_ 23 | 24 | #include 25 | 26 | /** Create a unique temporary file. 27 | @param dir (optional) directory to create file. If NULL use default TMP directory. 28 | @param prefix (optional) prefix for file name. If NULL use "tmp.". 29 | @param pathname (optional) pointer to a buffer to receive the temp filename. 30 | Allocated using `malloc()`; user to free. Ignored if NULL. 31 | @param keep If `keep` is nonzero and `pathname` is not NULL, then keep the file after closing. 32 | Otherwise file is automatically deleted when closed. 33 | @return Pointer to stream opened in binary read/write (w+b) mode, or a null pointer on error. 34 | @exception ENOMEM Not enough memory to allocate filename. 35 | */ 36 | FILE *tmpfileplus(const char *dir, const char *prefix, char **pathname, int keep); 37 | 38 | 39 | /** Create a unique temporary file with filename stored in a fixed-length buffer. 40 | @param dir (optional) directory to create file. If NULL use default directory. 41 | @param prefix (optional) prefix for file name. If NULL use "tmp.". 42 | @param pathnamebuf (optional) buffer to receive full pathname of temporary file. Ignored if NULL. 43 | @param pathsize Size of buffer to receive filename and its terminating null character. 44 | @param keep If `keep` is nonzero and `pathname` is not NULL, then keep the file after closing. 45 | Otherwise file is automatically deleted when closed. 46 | @return Pointer to stream opened in binary read/write (w+b) mode, or a null pointer on error. 47 | @exception E2BIG Resulting filename is too big for the buffer `pathnamebuf`. 48 | */ 49 | FILE *tmpfileplus_f(const char *dir, const char *prefix, char *pathnamebuf, size_t pathsize, int keep); 50 | 51 | #define TMPFILE_KEEP 1 52 | 53 | #endif /* end TMPFILEPLUS_H_ */ 54 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/ferdinandschaffler.xcuserdatad/xcschemes/Sourceful.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/michaelschaeffler.xcuserdatad/xcschemes/Sourceful.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /LibXlsxWriterSwiftSample/Examples/hyperlinks.swift: -------------------------------------------------------------------------------- 1 | // 2 | // hyperlinks.swift 3 | // LibXlsxWriterSwiftSample 4 | // 5 | 6 | import Foundation 7 | import xlsxwriter 8 | 9 | class Hyperlinks{ 10 | func generate() -> URL { 11 | let documentDirectory = try! FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor:nil, create:false) 12 | let fileURL = documentDirectory.appendingPathComponent("hyperlinks.xlsx") 13 | 14 | let workbook = workbook_new((fileURL.absoluteString.dropFirst(6) as NSString).fileSystemRepresentation) 15 | let worksheet = workbook_add_worksheet(workbook, nil) 16 | //Get the default url format (used in the overwriting examples below). 17 | let url_format = workbook_get_default_url_format(workbook) 18 | //Create a user defined link format. 19 | let red_format = workbook_add_format(workbook) 20 | format_set_underline (red_format, UInt8(LXW_UNDERLINE_SINGLE.rawValue)) 21 | format_set_font_color(red_format, LXW_COLOR_RED.rawValue) 22 | //Widen the first column to make the text clearer. 23 | worksheet_set_column(worksheet, 0, 0, 30, nil) 24 | //Write a hyperlink. A default blue underline will be used if the format is NULL. 25 | worksheet_write_url(worksheet, 0, 0, "http://libxlsxwriter.github.io", nil) 26 | //Write a hyperlink but overwrite the displayed string. Note, we need to specify the format for the string to match the default hyperlink. 27 | worksheet_write_url (worksheet, 2, 0, "http://libxlsxwriter.github.io", nil) 28 | worksheet_write_string(worksheet, 2, 0, "Read the documentation.", url_format) 29 | //Write a hyperlink with a different format. 30 | worksheet_write_url(worksheet, 4, 0, "http://libxlsxwriter.github.io", red_format) 31 | //Write a mail hyperlink. 32 | worksheet_write_url (worksheet, 6, 0, "mailto:jmcnamara@cpan.org", nil) 33 | //Write a mail hyperlink and overwrite the displayed string. We again specify the format for the string to match the default hyperlink. 34 | worksheet_write_url (worksheet, 8, 0, "mailto:jmcnamara@cpan.org", nil) 35 | worksheet_write_string(worksheet, 8, 0, "Drop me a line.", url_format) 36 | //Close the workbook, save the file and free any memory. 37 | workbook_close(workbook) 38 | 39 | return fileURL 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /LibXlsxWriterSwiftSample/SceneDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SceneDelegate.swift 3 | // LibXlsxWriterSwiftSample 4 | // 5 | 6 | import UIKit 7 | 8 | class SceneDelegate: UIResponder, UIWindowSceneDelegate { 9 | 10 | var window: UIWindow? 11 | 12 | 13 | func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { 14 | 15 | guard let windowScene = (scene as? UIWindowScene) else { return } 16 | window = UIWindow(frame: UIScreen.main.bounds) 17 | let mainPage = ExampleListPage() 18 | let navViewController = UINavigationController(rootViewController: mainPage) 19 | window?.rootViewController = navViewController 20 | window?.makeKeyAndVisible() 21 | window?.windowScene = windowScene 22 | } 23 | 24 | func sceneDidDisconnect(_ scene: UIScene) { 25 | // Called as the scene is being released by the system. 26 | // This occurs shortly after the scene enters the background, or when its session is discarded. 27 | // Release any resources associated with this scene that can be re-created the next time the scene connects. 28 | // The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead). 29 | } 30 | 31 | func sceneDidBecomeActive(_ scene: UIScene) { 32 | // Called when the scene has moved from an inactive state to an active state. 33 | // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. 34 | } 35 | 36 | func sceneWillResignActive(_ scene: UIScene) { 37 | // Called when the scene will move from an active state to an inactive state. 38 | // This may occur due to temporary interruptions (ex. an incoming phone call). 39 | } 40 | 41 | func sceneWillEnterForeground(_ scene: UIScene) { 42 | // Called as the scene transitions from the background to the foreground. 43 | // Use this method to undo the changes made on entering the background. 44 | } 45 | 46 | func sceneDidEnterBackground(_ scene: UIScene) { 47 | // Called as the scene transitions from the foreground to the background. 48 | // Use this method to save data, release shared resources, and store enough scene-specific state information 49 | // to restore the scene back to its current state. 50 | } 51 | 52 | 53 | } 54 | 55 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LibXlsxWriterSwiftSample 2 | This repository contains a Xcode example project showing how to use the libxlsxwriter [CocoaPod](https://cocoapods.org/pods/libxlsxwriter) with Swift for iOS. 3 | 4 | ## Goal of this Repository 5 | While using most of the C API from Swift is pretty straight forward, in some cases there are some modifications needed, in order to get everything working together. 6 | This repository aims to provide some examples on how to deal with such cases in Swift 5. These examples are based on the examples provided for the original C library, that can be found [here](https://libxlsxwriter.github.io/examples.html). 7 | 8 | ## Screencast 9 | ![Screencast](https://raw.githubusercontent.com/FrankenApps/LibXlsxWriterSwiftSample/master/AdditionalAssets/screencast_edited.gif "A Screencast") 10 | 11 | ## Basic Setup 12 | If you want to use this Pod in your own project, all you have to do is to add this 13 | ``` 14 | pod 'libxlsxwriter', '~> 0.9' 15 | ``` 16 | line to your Podfile and run `pod install`. In your Swift source file you can now import 17 | ``` 18 | import xlsxwriter 19 | ``` 20 | and use it's various c functions. 21 | 22 | ## Basic Example 23 | A basic example on how to generate a .xlsx file and save it to the app's documents directory would look like that: 24 | ```swift 25 | import Foundation 26 | import xlsxwriter 27 | 28 | class Hello{ 29 | func generate() -> URL { 30 | let documentDirectory = try! FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor:nil, create:false) 31 | let fileURL = documentDirectory.appendingPathComponent("hello_world.xlsx") 32 | 33 | let workbook = workbook_new((fileURL.absoluteString.dropFirst(6) as NSString).fileSystemRepresentation) 34 | let worksheet = workbook_add_worksheet(workbook, nil) 35 | worksheet_write_string(worksheet, 0, 0, "Hello", nil) 36 | worksheet_write_number(worksheet, 1, 0, 123, nil) 37 | workbook_close(workbook) 38 | 39 | return fileURL 40 | } 41 | } 42 | ``` 43 | 44 | ## Only run sample app 45 | You can test the sample app right in your browser [here](https://appetize.io/app/27dm506k4fjk2p0t0ct79yxu4g?device=iphone8&scale=75&orientation=portrait&osVersion=13.3) but the emulator does not support previewing the generated excel files. 46 | 47 | I will soon add a .ipa file, that can be installed on your physical device, using for example [AltStore](https://github.com/rileytestut/AltStore). 48 | -------------------------------------------------------------------------------- /Pods/libxlsxwriter/include/xlsxwriter/shared_strings.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libxlsxwriter 3 | * 4 | * Copyright 2014-2021, John McNamara, jmcnamara@cpan.org. See LICENSE.txt. 5 | * 6 | * shared_strings - A libxlsxwriter library for creating Excel XLSX 7 | * sst files. 8 | * 9 | */ 10 | #ifndef __LXW_SST_H__ 11 | #define __LXW_SST_H__ 12 | 13 | #include 14 | #include 15 | 16 | #include "common.h" 17 | 18 | /* Define a tree.h RB structure for storing shared strings. */ 19 | RB_HEAD(sst_rb_tree, sst_element); 20 | 21 | /* Define a queue.h structure for storing shared strings in insertion order. */ 22 | STAILQ_HEAD(sst_order_list, sst_element); 23 | 24 | /* Wrapper around RB_GENERATE_STATIC from tree.h to avoid unused function 25 | * warnings and to avoid portability issues with the _unused attribute. */ 26 | #define LXW_RB_GENERATE_ELEMENT(name, type, field, cmp) \ 27 | RB_GENERATE_INSERT_COLOR(name, type, field, static) \ 28 | RB_GENERATE_INSERT(name, type, field, cmp, static) \ 29 | /* Add unused struct to allow adding a semicolon */ \ 30 | struct lxw_rb_generate_element{int unused;} 31 | 32 | /* 33 | * Elements of the SST table. They contain pointers to allow them to 34 | * be stored in a RB tree and also pointers to track the insertion order 35 | * in a separate list. 36 | */ 37 | struct sst_element { 38 | uint32_t index; 39 | char *string; 40 | uint8_t is_rich_string; 41 | 42 | STAILQ_ENTRY (sst_element) sst_order_pointers; 43 | RB_ENTRY (sst_element) sst_tree_pointers; 44 | }; 45 | 46 | /* 47 | * Struct to represent a sst. 48 | */ 49 | typedef struct lxw_sst { 50 | FILE *file; 51 | 52 | uint32_t string_count; 53 | uint32_t unique_count; 54 | 55 | struct sst_order_list *order_list; 56 | struct sst_rb_tree *rb_tree; 57 | 58 | } lxw_sst; 59 | 60 | /* *INDENT-OFF* */ 61 | #ifdef __cplusplus 62 | extern "C" { 63 | #endif 64 | /* *INDENT-ON* */ 65 | 66 | lxw_sst *lxw_sst_new(void); 67 | void lxw_sst_free(lxw_sst *sst); 68 | struct sst_element *lxw_get_sst_index(lxw_sst *sst, const char *string, 69 | uint8_t is_rich_string); 70 | void lxw_sst_assemble_xml_file(lxw_sst *self); 71 | 72 | /* Declarations required for unit testing. */ 73 | #ifdef TESTING 74 | 75 | STATIC void _sst_xml_declaration(lxw_sst *self); 76 | 77 | #endif /* TESTING */ 78 | 79 | /* *INDENT-OFF* */ 80 | #ifdef __cplusplus 81 | } 82 | #endif 83 | /* *INDENT-ON* */ 84 | 85 | #endif /* __LXW_SST_H__ */ 86 | -------------------------------------------------------------------------------- /LibXlsxWriterSwiftSample/Examples/anatomy.swift: -------------------------------------------------------------------------------- 1 | // 2 | // anatomy.swift 3 | // LibXlsxWriterSwiftSample 4 | // 5 | import Foundation 6 | import xlsxwriter 7 | 8 | class Anatomy{ 9 | func generate() -> URL { 10 | let documentDirectory = try! FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor:nil, create:false) 11 | let fileURL = documentDirectory.appendingPathComponent("anatomy.xlsx") 12 | 13 | //Create a new workbook. 14 | //Ditch first 6 characters, because they are of the form file:// 15 | let workbook = workbook_new((fileURL.absoluteString.dropFirst(6) as NSString).fileSystemRepresentation) 16 | //Add a worksheet with a user defined sheet name. 17 | let worksheet1 = workbook_add_worksheet(workbook, "Demo") 18 | //Add a worksheet with Excel's default sheet name: Sheet2. 19 | let worksheet2 = workbook_add_worksheet(workbook, nil) 20 | //Add some cell formats. 21 | let myformat1 = workbook_add_format(workbook) 22 | let myformat2 = workbook_add_format(workbook) 23 | //Set the bold property for the first format. 24 | format_set_bold(myformat1) 25 | //Set a number format for the second format. 26 | format_set_num_format(myformat2, "$#,##0.00") 27 | //Widen the first column to make the text clearer. 28 | worksheet_set_column(worksheet1, 0, 0, 20, nil) 29 | //Write some unformatted data. 30 | worksheet_write_string(worksheet1, 0, 0, "Peach", nil) 31 | worksheet_write_string(worksheet1, 1, 0, "Plum", nil) 32 | //Write formatted data. 33 | worksheet_write_string(worksheet1, 2, 0, "Pear", myformat1) 34 | //Formats can be reused. 35 | worksheet_write_string(worksheet1, 3, 0, "Persimmon", myformat1) 36 | //Write some numbers. 37 | worksheet_write_number(worksheet1, 5, 0, 123, nil) 38 | worksheet_write_number(worksheet1, 6, 0, 4567.555, myformat2) 39 | //Write to the second worksheet. 40 | worksheet_write_string(worksheet2, 0, 0, "Some text", myformat1) 41 | //Close the workbook, save the file and free any memory. 42 | let error = workbook_close(workbook) 43 | //Check if there was any error creating the xlsx file. 44 | if (error.rawValue != LXW_NO_ERROR.rawValue){ 45 | print("Error in workbook_close().\nError %d = %s\n", error, lxw_strerror(error)!) 46 | } 47 | 48 | return fileURL 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Pods/libxlsxwriter/Readme.md: -------------------------------------------------------------------------------- 1 | # libxlsxwriter 2 | 3 | 4 | Libxlsxwriter: A C library for creating Excel XLSX files. 5 | 6 | 7 | ![demo image](http://libxlsxwriter.github.io/demo.png) 8 | 9 | 10 | ## The libxlsxwriter library 11 | 12 | Libxlsxwriter is a C library that can be used to write text, numbers, formulas 13 | and hyperlinks to multiple worksheets in an Excel 2007+ XLSX file. 14 | 15 | It supports features such as: 16 | 17 | - 100% compatible Excel XLSX files. 18 | - Full Excel formatting. 19 | - Merged cells. 20 | - Defined names. 21 | - Autofilters. 22 | - Charts. 23 | - Data validation and drop down lists. 24 | - Conditional formatting. 25 | - Worksheet PNG/JPEG/GIF images. 26 | - Cell comments. 27 | - Support for adding Macros. 28 | - Memory optimization mode for writing large files. 29 | - Source code available on [GitHub](https://github.com/jmcnamara/libxlsxwriter). 30 | - FreeBSD license. 31 | - ANSI C. 32 | - Works with GCC, Clang, Xcode, MSVC 2015, ICC, TCC, MinGW, MingGW-w64/32. 33 | - Works on Linux, FreeBSD, OpenBSD, OS X, iOS and Windows. Also works on MSYS/MSYS2 and Cygwin. 34 | - Compiles for 32 and 64 bit. 35 | - Compiles and works on big and little endian systems. 36 | - The only dependency is on `zlib`. 37 | 38 | Here is an example that was used to create the spreadsheet shown above: 39 | 40 | 41 | ```C 42 | #include "xlsxwriter.h" 43 | 44 | int main() { 45 | 46 | /* Create a new workbook and add a worksheet. */ 47 | lxw_workbook *workbook = workbook_new("demo.xlsx"); 48 | lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL); 49 | 50 | /* Add a format. */ 51 | lxw_format *format = workbook_add_format(workbook); 52 | 53 | /* Set the bold property for the format */ 54 | format_set_bold(format); 55 | 56 | /* Change the column width for clarity. */ 57 | worksheet_set_column(worksheet, 0, 0, 20, NULL); 58 | 59 | /* Write some simple text. */ 60 | worksheet_write_string(worksheet, 0, 0, "Hello", NULL); 61 | 62 | /* Text with formatting. */ 63 | worksheet_write_string(worksheet, 1, 0, "World", format); 64 | 65 | /* Write some numbers. */ 66 | worksheet_write_number(worksheet, 2, 0, 123, NULL); 67 | worksheet_write_number(worksheet, 3, 0, 123.456, NULL); 68 | 69 | /* Insert an image. */ 70 | worksheet_insert_image(worksheet, 1, 2, "logo.png"); 71 | 72 | workbook_close(workbook); 73 | 74 | return 0; 75 | } 76 | 77 | ``` 78 | 79 | 80 | 81 | See the [full documentation](http://libxlsxwriter.github.io) for the getting 82 | started guide, a tutorial, the main API documentation and examples. 83 | 84 | -------------------------------------------------------------------------------- /Pods/Sourceful/Sources/Util/NSMutableAttributedString+Tokens.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NSMutableAttributedString+Tokens.swift 3 | // SavannaKit 4 | // 5 | // Created by Louis D'hauwe on 02/05/2018. 6 | // Copyright © 2018 Silver Fox. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | #if os(macOS) 12 | import AppKit 13 | #else 14 | import UIKit 15 | #endif 16 | 17 | public extension NSMutableAttributedString { 18 | 19 | convenience init(source: String, tokens: [Token], theme: SyntaxColorTheme) { 20 | 21 | self.init(string: source) 22 | 23 | var attributes = [NSAttributedString.Key: Any]() 24 | 25 | let spaceAttrString = NSAttributedString(string: " ", attributes: [.font: theme.font]) 26 | let spaceWidth = spaceAttrString.size().width 27 | 28 | let themeInfo = ThemeInfo(theme: theme, spaceWidth: spaceWidth) 29 | 30 | let paragraphStyle = NSMutableParagraphStyle() 31 | paragraphStyle.paragraphSpacing = 2.0 32 | paragraphStyle.defaultTabInterval = themeInfo.spaceWidth * 4 33 | paragraphStyle.tabStops = [] 34 | 35 | // Improve performance by manually specifying writing direction. 36 | paragraphStyle.baseWritingDirection = .leftToRight 37 | paragraphStyle.alignment = .left 38 | 39 | let wholeRange = NSRange(location: 0, length: source.count) 40 | 41 | attributes[.paragraphStyle] = paragraphStyle 42 | 43 | for (attr, value) in theme.globalAttributes() { 44 | attributes[attr] = value 45 | } 46 | 47 | self.setAttributes(attributes, range: wholeRange) 48 | 49 | for token in tokens { 50 | 51 | if token.isPlain { 52 | continue 53 | } 54 | 55 | let tokenRange = token.range 56 | 57 | let range = source.nsRange(fromRange: tokenRange) 58 | 59 | if token.isEditorPlaceholder { 60 | 61 | let startRange = NSRange(location: range.lowerBound, length: 2) 62 | let endRange = NSRange(location: range.upperBound - 2, length: 2) 63 | 64 | let contentRange = NSRange(location: range.lowerBound + 2, length: range.length - 4) 65 | 66 | var attr = [NSAttributedString.Key: Any]() 67 | 68 | attr[.editorPlaceholder] = EditorPlaceholderState.inactive 69 | 70 | self.addAttributes(theme.attributes(for: token), range: contentRange) 71 | 72 | self.addAttributes([.foregroundColor: Color.clear, .font: Font.systemFont(ofSize: 0.01)], range: startRange) 73 | self.addAttributes([.foregroundColor: Color.clear, .font: Font.systemFont(ofSize: 0.01)], range: endRange) 74 | 75 | self.addAttributes(attr, range: range) 76 | continue 77 | } 78 | 79 | self.setAttributes(theme.attributes(for: token), range: range) 80 | 81 | } 82 | 83 | } 84 | 85 | } 86 | -------------------------------------------------------------------------------- /LibXlsxWriterSwiftSample/Examples/dates_and_times03.swift: -------------------------------------------------------------------------------- 1 | // 2 | // dates_and_times03.swift 3 | // LibXlsxWriterSwiftSample 4 | // 5 | 6 | import Foundation 7 | import xlsxwriter 8 | 9 | class DatesAndTimes03{ 10 | func generate() -> URL { 11 | //A number to display as a date. 12 | var datetime = lxw_datetime(year: 2013, month: 1, day: 23, hour: 12, min: 30, sec: 5.123) 13 | 14 | //Examples date and time formats. In the output file compare how changing the format strings changes the appearance of the date. 15 | let date_formats = [ 16 | "dd/mm/yy", 17 | "mm/dd/yy", 18 | "dd m yy", 19 | "d mm yy", 20 | "d mmm yy", 21 | "d mmmm yy", 22 | "d mmmm yyy", 23 | "d mmmm yyyy", 24 | "dd/mm/yy hh:mm", 25 | "dd/mm/yy hh:mm:ss", 26 | "dd/mm/yy hh:mm:ss.000", 27 | "hh:mm", 28 | "hh:mm:ss", 29 | "hh:mm:ss.000", 30 | ] 31 | 32 | let documentDirectory = try! FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor:nil, create:false) 33 | let fileURL = documentDirectory.appendingPathComponent("date_and_times03.xlsx") 34 | 35 | let workbook = workbook_new((fileURL.absoluteString.dropFirst(6) as NSString).fileSystemRepresentation) 36 | let worksheet = workbook_add_worksheet(workbook, nil) 37 | 38 | //Add a bold format. 39 | let bold = workbook_add_format(workbook) 40 | format_set_bold(bold) 41 | //Write the column headers. 42 | worksheet_write_string(worksheet, 0, 0, "Formatted date", bold) 43 | worksheet_write_string(worksheet, 0, 1, "Format", bold) 44 | //Widen the first column to make the text clearer. 45 | worksheet_set_column(worksheet, 0, 1, 20, nil) 46 | //Write the same date and time using each of the above formats. 47 | var row = 0 48 | for i in 0..<14 { 49 | row+=1 50 | //Create a format for the date or time. 51 | let format = workbook_add_format(workbook) 52 | format_set_num_format(format, date_formats[i]) 53 | format_set_align(format, UInt8(LXW_ALIGN_LEFT.rawValue)) 54 | //Write the datetime with each format. 55 | worksheet_write_datetime(worksheet, lxw_row_t(row), 0, &datetime, format) 56 | //Also write the format string for comparison 57 | worksheet_write_string(worksheet, lxw_row_t(row), 1, date_formats[i], nil) 58 | } 59 | 60 | workbook_close(workbook) 61 | 62 | return fileURL 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /Pods/libxlsxwriter/include/xlsxwriter/packager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libxlsxwriter 3 | * 4 | * Copyright 2014-2021, John McNamara, jmcnamara@cpan.org. See LICENSE.txt. 5 | * 6 | * packager - A libxlsxwriter library for creating Excel XLSX packager files. 7 | * 8 | */ 9 | #ifndef __LXW_PACKAGER_H__ 10 | #define __LXW_PACKAGER_H__ 11 | 12 | #include 13 | 14 | #ifdef USE_SYSTEM_MINIZIP 15 | #include "minizip/zip.h" 16 | #else 17 | #include "third_party/zip.h" 18 | #endif 19 | 20 | #include "common.h" 21 | #include "workbook.h" 22 | #include "worksheet.h" 23 | #include "shared_strings.h" 24 | #include "app.h" 25 | #include "core.h" 26 | #include "custom.h" 27 | #include "theme.h" 28 | #include "styles.h" 29 | #include "format.h" 30 | #include "content_types.h" 31 | #include "relationships.h" 32 | #include "vml.h" 33 | #include "comment.h" 34 | #include "metadata.h" 35 | 36 | #define LXW_ZIP_BUFFER_SIZE (16384) 37 | 38 | /* If zip returns a ZIP_XXX error then errno is set and we can trap that in 39 | * workbook.c. Otherwise return a default libxlsxwriter error. */ 40 | #define RETURN_ON_ZIP_ERROR(err, default_err) \ 41 | do { \ 42 | if (err == ZIP_ERRNO) \ 43 | return LXW_ERROR_ZIP_FILE_OPERATION; \ 44 | else if (err == ZIP_PARAMERROR) \ 45 | return LXW_ERROR_ZIP_PARAMETER_ERROR; \ 46 | else if (err == ZIP_BADZIPFILE) \ 47 | return LXW_ERROR_ZIP_BAD_ZIP_FILE; \ 48 | else if (err == ZIP_INTERNALERROR) \ 49 | return LXW_ERROR_ZIP_INTERNAL_ERROR; \ 50 | else \ 51 | return default_err; \ 52 | } while (0) 53 | 54 | /* 55 | * Struct to represent a packager. 56 | */ 57 | typedef struct lxw_packager { 58 | 59 | FILE *file; 60 | lxw_workbook *workbook; 61 | 62 | size_t buffer_size; 63 | zipFile zipfile; 64 | zip_fileinfo zipfile_info; 65 | char *filename; 66 | char *buffer; 67 | char *tmpdir; 68 | uint8_t use_zip64; 69 | 70 | } lxw_packager; 71 | 72 | 73 | /* *INDENT-OFF* */ 74 | #ifdef __cplusplus 75 | extern "C" { 76 | #endif 77 | /* *INDENT-ON* */ 78 | 79 | lxw_packager *lxw_packager_new(const char *filename, char *tmpdir, 80 | uint8_t use_zip64); 81 | void lxw_packager_free(lxw_packager *packager); 82 | lxw_error lxw_create_package(lxw_packager *self); 83 | 84 | /* Declarations required for unit testing. */ 85 | #ifdef TESTING 86 | 87 | #endif /* TESTING */ 88 | 89 | /* *INDENT-OFF* */ 90 | #ifdef __cplusplus 91 | } 92 | #endif 93 | /* *INDENT-ON* */ 94 | 95 | #endif /* __LXW_PACKAGER_H__ */ 96 | -------------------------------------------------------------------------------- /Pods/libxlsxwriter/include/xlsxwriter/drawing.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libxlsxwriter 3 | * 4 | * Copyright 2014-2021, John McNamara, jmcnamara@cpan.org. See LICENSE.txt. 5 | * 6 | * drawing - A libxlsxwriter library for creating Excel XLSX drawing files. 7 | * 8 | */ 9 | #ifndef __LXW_DRAWING_H__ 10 | #define __LXW_DRAWING_H__ 11 | 12 | #include 13 | #include 14 | 15 | #include "common.h" 16 | 17 | STAILQ_HEAD(lxw_drawing_objects, lxw_drawing_object); 18 | 19 | enum lxw_drawing_types { 20 | LXW_DRAWING_NONE = 0, 21 | LXW_DRAWING_IMAGE, 22 | LXW_DRAWING_CHART, 23 | LXW_DRAWING_SHAPE 24 | }; 25 | 26 | enum image_types { 27 | LXW_IMAGE_UNKNOWN = 0, 28 | LXW_IMAGE_PNG, 29 | LXW_IMAGE_JPEG, 30 | LXW_IMAGE_BMP, 31 | LXW_IMAGE_GIF 32 | }; 33 | 34 | /* Coordinates used in a drawing object. */ 35 | typedef struct lxw_drawing_coords { 36 | uint32_t col; 37 | uint32_t row; 38 | double col_offset; 39 | double row_offset; 40 | } lxw_drawing_coords; 41 | 42 | /* Object to represent the properties of a drawing. */ 43 | typedef struct lxw_drawing_object { 44 | uint8_t type; 45 | uint8_t anchor; 46 | struct lxw_drawing_coords from; 47 | struct lxw_drawing_coords to; 48 | uint32_t col_absolute; 49 | uint32_t row_absolute; 50 | uint32_t width; 51 | uint32_t height; 52 | uint8_t shape; 53 | uint32_t rel_index; 54 | uint32_t url_rel_index; 55 | char *description; 56 | char *tip; 57 | uint8_t decorative; 58 | 59 | STAILQ_ENTRY (lxw_drawing_object) list_pointers; 60 | 61 | } lxw_drawing_object; 62 | 63 | /* 64 | * Struct to represent a collection of drawings. 65 | */ 66 | typedef struct lxw_drawing { 67 | 68 | FILE *file; 69 | 70 | uint8_t embedded; 71 | uint8_t orientation; 72 | 73 | struct lxw_drawing_objects *drawing_objects; 74 | 75 | } lxw_drawing; 76 | 77 | 78 | /* *INDENT-OFF* */ 79 | #ifdef __cplusplus 80 | extern "C" { 81 | #endif 82 | /* *INDENT-ON* */ 83 | 84 | lxw_drawing *lxw_drawing_new(void); 85 | void lxw_drawing_free(lxw_drawing *drawing); 86 | void lxw_drawing_assemble_xml_file(lxw_drawing *self); 87 | void lxw_free_drawing_object(struct lxw_drawing_object *drawing_object); 88 | void lxw_add_drawing_object(lxw_drawing *drawing, 89 | lxw_drawing_object *drawing_object); 90 | 91 | /* Declarations required for unit testing. */ 92 | #ifdef TESTING 93 | 94 | STATIC void _drawing_xml_declaration(lxw_drawing *self); 95 | #endif /* TESTING */ 96 | 97 | /* *INDENT-OFF* */ 98 | #ifdef __cplusplus 99 | } 100 | #endif 101 | /* *INDENT-ON* */ 102 | 103 | #endif /* __LXW_DRAWING_H__ */ 104 | -------------------------------------------------------------------------------- /Pods/Sourceful/Sources/View/TextViewWrapperView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TextViewWrapperView.swift 3 | // SavannaKit 4 | // 5 | // Created by Louis D'hauwe on 17/02/2018. 6 | // Copyright © 2018 Silver Fox. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | #if os(macOS) 12 | import AppKit 13 | #else 14 | import UIKit 15 | #endif 16 | 17 | #if os(macOS) 18 | 19 | class TextViewWrapperView: View { 20 | 21 | override func hitTest(_ point: NSPoint) -> NSView? { 22 | // Disable interaction, so we're not blocking the text view. 23 | return nil 24 | } 25 | 26 | override func layout() { 27 | super.layout() 28 | 29 | self.setNeedsDisplay(self.bounds) 30 | } 31 | 32 | override func resize(withOldSuperviewSize oldSize: NSSize) { 33 | super.resize(withOldSuperviewSize: oldSize) 34 | 35 | self.textView?.invalidateCachedParagraphs() 36 | 37 | self.setNeedsDisplay(self.bounds) 38 | 39 | } 40 | 41 | var textView: InnerTextView? 42 | 43 | override public func draw(_ rect: CGRect) { 44 | 45 | guard let textView = textView else { 46 | return 47 | } 48 | 49 | guard let theme = textView.theme else { 50 | super.draw(rect) 51 | textView.hideGutter() 52 | return 53 | } 54 | 55 | if theme.lineNumbersStyle == nil { 56 | 57 | textView.hideGutter() 58 | 59 | let gutterRect = CGRect(x: 0, y: rect.minY, width: textView.gutterWidth, height: rect.height) 60 | let path = BezierPath(rect: gutterRect) 61 | path.fill() 62 | 63 | } else { 64 | 65 | let contentHeight = textView.enclosingScrollView!.documentView!.bounds.height 66 | 67 | let yOffset = self.bounds.height - contentHeight 68 | 69 | var paragraphs: [Paragraph] 70 | 71 | if let cached = textView.cachedParagraphs { 72 | 73 | paragraphs = cached 74 | 75 | } else { 76 | 77 | paragraphs = generateParagraphs(for: textView, flipRects: true) 78 | textView.cachedParagraphs = paragraphs 79 | 80 | } 81 | 82 | paragraphs = offsetParagraphs(paragraphs, for: textView, yOffset: yOffset) 83 | 84 | let components = textView.text.components(separatedBy: .newlines) 85 | 86 | let count = components.count 87 | 88 | let maxNumberOfDigits = "\(count)".count 89 | 90 | textView.updateGutterWidth(for: maxNumberOfDigits) 91 | 92 | theme.gutterStyle.backgroundColor.setFill() 93 | 94 | let gutterRect = CGRect(x: 0, y: 0, width: textView.gutterWidth, height: rect.height) 95 | let path = BezierPath(rect: gutterRect) 96 | path.fill() 97 | 98 | drawLineNumbers(paragraphs, in: rect, for: textView) 99 | 100 | } 101 | 102 | } 103 | 104 | } 105 | 106 | #endif 107 | -------------------------------------------------------------------------------- /LibXlsxWriterSwiftSample/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "Logo2-20@2x.png", 5 | "idiom" : "iphone", 6 | "scale" : "2x", 7 | "size" : "20x20" 8 | }, 9 | { 10 | "filename" : "Logo2-20@3x.png", 11 | "idiom" : "iphone", 12 | "scale" : "3x", 13 | "size" : "20x20" 14 | }, 15 | { 16 | "filename" : "Logo2-29@2x.png", 17 | "idiom" : "iphone", 18 | "scale" : "2x", 19 | "size" : "29x29" 20 | }, 21 | { 22 | "filename" : "Logo2-29@3x.png", 23 | "idiom" : "iphone", 24 | "scale" : "3x", 25 | "size" : "29x29" 26 | }, 27 | { 28 | "filename" : "Logo2-40@2x.png", 29 | "idiom" : "iphone", 30 | "scale" : "2x", 31 | "size" : "40x40" 32 | }, 33 | { 34 | "filename" : "Logo2-40@3x.png", 35 | "idiom" : "iphone", 36 | "scale" : "3x", 37 | "size" : "40x40" 38 | }, 39 | { 40 | "filename" : "Logo2-60@2x.png", 41 | "idiom" : "iphone", 42 | "scale" : "2x", 43 | "size" : "60x60" 44 | }, 45 | { 46 | "filename" : "Logo2-60@3x.png", 47 | "idiom" : "iphone", 48 | "scale" : "3x", 49 | "size" : "60x60" 50 | }, 51 | { 52 | "filename" : "Logo2-20.png", 53 | "idiom" : "ipad", 54 | "scale" : "1x", 55 | "size" : "20x20" 56 | }, 57 | { 58 | "filename" : "Logo2-20@2x.png", 59 | "idiom" : "ipad", 60 | "scale" : "2x", 61 | "size" : "20x20" 62 | }, 63 | { 64 | "filename" : "Logo2-29.png", 65 | "idiom" : "ipad", 66 | "scale" : "1x", 67 | "size" : "29x29" 68 | }, 69 | { 70 | "filename" : "Logo2-29@2x.png", 71 | "idiom" : "ipad", 72 | "scale" : "2x", 73 | "size" : "29x29" 74 | }, 75 | { 76 | "filename" : "Logo2-40.png", 77 | "idiom" : "ipad", 78 | "scale" : "1x", 79 | "size" : "40x40" 80 | }, 81 | { 82 | "filename" : "Logo2-40@2x.png", 83 | "idiom" : "ipad", 84 | "scale" : "2x", 85 | "size" : "40x40" 86 | }, 87 | { 88 | "filename" : "Logo2-76.png", 89 | "idiom" : "ipad", 90 | "scale" : "1x", 91 | "size" : "76x76" 92 | }, 93 | { 94 | "filename" : "Logo2-76@2x.png", 95 | "idiom" : "ipad", 96 | "scale" : "2x", 97 | "size" : "76x76" 98 | }, 99 | { 100 | "filename" : "Logo2-83.5@2x.png", 101 | "idiom" : "ipad", 102 | "scale" : "2x", 103 | "size" : "83.5x83.5" 104 | }, 105 | { 106 | "filename" : "Logo2-1024.png", 107 | "idiom" : "ios-marketing", 108 | "scale" : "1x", 109 | "size" : "1024x1024" 110 | } 111 | ], 112 | "info" : { 113 | "author" : "xcode", 114 | "version" : 1 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /Pods/libxlsxwriter/include/xlsxwriter/content_types.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libxlsxwriter 3 | * 4 | * Copyright 2014-2021, John McNamara, jmcnamara@cpan.org. See LICENSE.txt. 5 | * 6 | * content_types - A libxlsxwriter library for creating Excel XLSX 7 | * content_types files. 8 | * 9 | */ 10 | #ifndef __LXW_CONTENT_TYPES_H__ 11 | #define __LXW_CONTENT_TYPES_H__ 12 | 13 | #include 14 | #include 15 | 16 | #include "common.h" 17 | 18 | #define LXW_APP_PACKAGE "application/vnd.openxmlformats-package." 19 | #define LXW_APP_DOCUMENT "application/vnd.openxmlformats-officedocument." 20 | #define LXW_APP_MSEXCEL "application/vnd.ms-excel." 21 | 22 | /* 23 | * Struct to represent a content_types. 24 | */ 25 | typedef struct lxw_content_types { 26 | 27 | FILE *file; 28 | 29 | struct lxw_tuples *default_types; 30 | struct lxw_tuples *overrides; 31 | 32 | } lxw_content_types; 33 | 34 | 35 | /* *INDENT-OFF* */ 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | /* *INDENT-ON* */ 40 | 41 | lxw_content_types *lxw_content_types_new(void); 42 | void lxw_content_types_free(lxw_content_types *content_types); 43 | void lxw_content_types_assemble_xml_file(lxw_content_types *content_types); 44 | void lxw_ct_add_default(lxw_content_types *content_types, const char *key, 45 | const char *value); 46 | void lxw_ct_add_override(lxw_content_types *content_types, const char *key, 47 | const char *value); 48 | void lxw_ct_add_worksheet_name(lxw_content_types *content_types, 49 | const char *name); 50 | void lxw_ct_add_chartsheet_name(lxw_content_types *content_types, 51 | const char *name); 52 | void lxw_ct_add_chart_name(lxw_content_types *content_types, 53 | const char *name); 54 | void lxw_ct_add_drawing_name(lxw_content_types *content_types, 55 | const char *name); 56 | void lxw_ct_add_comment_name(lxw_content_types *content_types, 57 | const char *name); 58 | void lxw_ct_add_vml_name(lxw_content_types *content_types); 59 | 60 | void lxw_ct_add_shared_strings(lxw_content_types *content_types); 61 | void lxw_ct_add_calc_chain(lxw_content_types *content_types); 62 | void lxw_ct_add_custom_properties(lxw_content_types *content_types); 63 | void lxw_ct_add_metadata(lxw_content_types *content_types); 64 | 65 | /* Declarations required for unit testing. */ 66 | #ifdef TESTING 67 | 68 | STATIC void _content_types_xml_declaration(lxw_content_types *self); 69 | STATIC void _write_default(lxw_content_types *self, const char *ext, 70 | const char *type); 71 | STATIC void _write_override(lxw_content_types *self, const char *part_name, 72 | const char *type); 73 | 74 | #endif /* TESTING */ 75 | 76 | /* *INDENT-OFF* */ 77 | #ifdef __cplusplus 78 | } 79 | #endif 80 | /* *INDENT-ON* */ 81 | 82 | #endif /* __LXW_CONTENT_TYPES_H__ */ 83 | -------------------------------------------------------------------------------- /Pods/Sourceful/Sources/View/SyntaxTextViewLayoutManager.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SyntaxTextViewLayoutManager.swift 3 | // SavannaKit iOS 4 | // 5 | // Created by Louis D'hauwe on 09/03/2018. 6 | // Copyright © 2018 Silver Fox. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import CoreGraphics 11 | 12 | #if os(macOS) 13 | import AppKit 14 | #else 15 | import UIKit 16 | #endif 17 | 18 | public enum EditorPlaceholderState { 19 | case active 20 | case inactive 21 | } 22 | 23 | public extension NSAttributedString.Key { 24 | 25 | static let editorPlaceholder = NSAttributedString.Key("editorPlaceholder") 26 | 27 | } 28 | 29 | class SyntaxTextViewLayoutManager: NSLayoutManager { 30 | 31 | override func drawGlyphs(forGlyphRange glyphsToShow: NSRange, at origin: CGPoint) { 32 | 33 | #if os(macOS) 34 | 35 | guard let context = NSGraphicsContext.current else { 36 | return 37 | } 38 | 39 | #else 40 | 41 | guard let context = UIGraphicsGetCurrentContext() else { 42 | return 43 | } 44 | 45 | #endif 46 | 47 | let range = characterRange(forGlyphRange: glyphsToShow, actualGlyphRange: nil) 48 | 49 | var placeholders = [(CGRect, EditorPlaceholderState)]() 50 | 51 | textStorage?.enumerateAttribute(.editorPlaceholder, in: range, options: [], using: { (value, range, stop) in 52 | 53 | if let state = value as? EditorPlaceholderState { 54 | 55 | // the color set above 56 | let glyphRange = self.glyphRange(forCharacterRange: range, actualCharacterRange: nil) 57 | let container = self.textContainer(forGlyphAt: glyphRange.location, effectiveRange: nil) 58 | 59 | let rect = self.boundingRect(forGlyphRange: glyphRange, in: container ?? NSTextContainer()) 60 | 61 | placeholders.append((rect, state)) 62 | 63 | } 64 | 65 | }) 66 | 67 | #if os(macOS) 68 | 69 | context.saveGraphicsState() 70 | context.cgContext.translateBy(x: origin.x, y: origin.y) 71 | 72 | #else 73 | 74 | context.saveGState() 75 | context.translateBy(x: origin.x, y: origin.y) 76 | 77 | #endif 78 | 79 | for (rect, state) in placeholders { 80 | 81 | // UIBezierPath with rounded 82 | 83 | let color: Color 84 | 85 | switch state { 86 | case .active: 87 | color = Color.white.withAlphaComponent(0.8) 88 | case .inactive: 89 | color = .darkGray 90 | } 91 | 92 | color.setFill() 93 | 94 | let radius: CGFloat = 4.0 95 | 96 | #if os(macOS) 97 | 98 | let path = BezierPath(roundedRect: rect, xRadius: radius, yRadius: radius) 99 | 100 | #else 101 | 102 | let path = BezierPath(roundedRect: rect, cornerRadius: radius) 103 | 104 | #endif 105 | 106 | path.fill() 107 | 108 | } 109 | 110 | #if os(macOS) 111 | 112 | context.restoreGraphicsState() 113 | 114 | #else 115 | 116 | context.restoreGState() 117 | 118 | #endif 119 | 120 | super.drawGlyphs(forGlyphRange: glyphsToShow, at: origin) 121 | 122 | } 123 | 124 | } 125 | -------------------------------------------------------------------------------- /Pods/libxlsxwriter/include/xlsxwriter/styles.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libxlsxwriter 3 | * 4 | * Copyright 2014-2021, John McNamara, jmcnamara@cpan.org. See LICENSE.txt. 5 | * 6 | * styles - A libxlsxwriter library for creating Excel XLSX styles files. 7 | * 8 | */ 9 | #ifndef __LXW_STYLES_H__ 10 | #define __LXW_STYLES_H__ 11 | 12 | #include 13 | #include 14 | 15 | #include "format.h" 16 | 17 | /* 18 | * Struct to represent a styles. 19 | */ 20 | typedef struct lxw_styles { 21 | 22 | FILE *file; 23 | uint32_t font_count; 24 | uint32_t xf_count; 25 | uint32_t dxf_count; 26 | uint32_t num_format_count; 27 | uint32_t border_count; 28 | uint32_t fill_count; 29 | struct lxw_formats *xf_formats; 30 | struct lxw_formats *dxf_formats; 31 | uint8_t has_hyperlink; 32 | uint16_t hyperlink_font_id; 33 | uint8_t has_comments; 34 | 35 | } lxw_styles; 36 | 37 | 38 | /* *INDENT-OFF* */ 39 | #ifdef __cplusplus 40 | extern "C" { 41 | #endif 42 | /* *INDENT-ON* */ 43 | 44 | lxw_styles *lxw_styles_new(void); 45 | void lxw_styles_free(lxw_styles *styles); 46 | void lxw_styles_assemble_xml_file(lxw_styles *self); 47 | void lxw_styles_write_string_fragment(lxw_styles *self, char *string); 48 | void lxw_styles_write_rich_font(lxw_styles *styles, lxw_format *format); 49 | 50 | /* Declarations required for unit testing. */ 51 | #ifdef TESTING 52 | 53 | STATIC void _styles_xml_declaration(lxw_styles *self); 54 | STATIC void _write_style_sheet(lxw_styles *self); 55 | STATIC void _write_font_size(lxw_styles *self, double font_size); 56 | STATIC void _write_font_color_theme(lxw_styles *self, uint8_t theme); 57 | STATIC void _write_font_name(lxw_styles *self, const char *font_name, 58 | uint8_t is_rich_string); 59 | STATIC void _write_font_family(lxw_styles *self, uint8_t font_family); 60 | STATIC void _write_font_scheme(lxw_styles *self, const char *font_scheme); 61 | STATIC void _write_font(lxw_styles *self, lxw_format *format, uint8_t is_dxf, 62 | uint8_t is_rich_string); 63 | STATIC void _write_fonts(lxw_styles *self); 64 | STATIC void _write_default_fill(lxw_styles *self, const char *pattern); 65 | STATIC void _write_fills(lxw_styles *self); 66 | STATIC void _write_border(lxw_styles *self, lxw_format *format, 67 | uint8_t is_dxf); 68 | STATIC void _write_borders(lxw_styles *self); 69 | STATIC void _write_style_xf(lxw_styles *self, uint8_t has_hyperlink, 70 | uint16_t font_id); 71 | STATIC void _write_cell_style_xfs(lxw_styles *self); 72 | STATIC void _write_xf(lxw_styles *self, lxw_format *format); 73 | STATIC void _write_cell_xfs(lxw_styles *self); 74 | STATIC void _write_cell_style(lxw_styles *self, char *name, uint8_t xf_id, 75 | uint8_t builtin_id); 76 | STATIC void _write_cell_styles(lxw_styles *self); 77 | STATIC void _write_dxfs(lxw_styles *self); 78 | STATIC void _write_table_styles(lxw_styles *self); 79 | 80 | #endif /* TESTING */ 81 | 82 | /* *INDENT-OFF* */ 83 | #ifdef __cplusplus 84 | } 85 | #endif 86 | /* *INDENT-ON* */ 87 | 88 | #endif /* __LXW_STYLES_H__ */ 89 | -------------------------------------------------------------------------------- /Pods/Sourceful/Sources/Model/RegexLexer.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RegexLexer.swift 3 | // SavannaKit 4 | // 5 | // Created by Louis D'hauwe on 05/07/2018. 6 | // Copyright © 2018 Silver Fox. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public typealias TokenTransformer = (_ range: Range) -> Token 12 | 13 | public struct RegexTokenGenerator { 14 | 15 | public let regularExpression: NSRegularExpression 16 | 17 | public let tokenTransformer: TokenTransformer 18 | 19 | public init(regularExpression: NSRegularExpression, tokenTransformer: @escaping TokenTransformer) { 20 | self.regularExpression = regularExpression 21 | self.tokenTransformer = tokenTransformer 22 | } 23 | } 24 | 25 | public struct KeywordTokenGenerator { 26 | 27 | public let keywords: [String] 28 | 29 | public let tokenTransformer: TokenTransformer 30 | 31 | public init(keywords: [String], tokenTransformer: @escaping TokenTransformer) { 32 | self.keywords = keywords 33 | self.tokenTransformer = tokenTransformer 34 | } 35 | 36 | } 37 | 38 | public enum TokenGenerator { 39 | case keywords(KeywordTokenGenerator) 40 | case regex(RegexTokenGenerator) 41 | } 42 | 43 | public protocol RegexLexer: Lexer { 44 | 45 | func generators(source: String) -> [TokenGenerator] 46 | 47 | } 48 | 49 | extension RegexLexer { 50 | 51 | public func getSavannaTokens(input: String) -> [Token] { 52 | 53 | let generators = self.generators(source: input) 54 | 55 | var tokens = [Token]() 56 | 57 | for generator in generators { 58 | 59 | switch generator { 60 | case .regex(let regexGenerator): 61 | tokens.append(contentsOf: generateRegexTokens(regexGenerator, source: input)) 62 | 63 | case .keywords(let keywordGenerator): 64 | tokens.append(contentsOf: generateKeywordTokens(keywordGenerator, source: input)) 65 | 66 | } 67 | 68 | } 69 | 70 | return tokens 71 | } 72 | 73 | } 74 | 75 | extension RegexLexer { 76 | 77 | func generateKeywordTokens(_ generator: KeywordTokenGenerator, source: String) -> [Token] { 78 | 79 | var tokens = [Token]() 80 | 81 | source.enumerateSubstrings(in: source.startIndex.. [Token] { 96 | 97 | var tokens = [Token]() 98 | 99 | let fullNSRange = NSRange(location: 0, length: source.utf16.count) 100 | for numberMatch in generator.regularExpression.matches(in: source, options: [], range: fullNSRange) { 101 | 102 | guard let swiftRange = Range(numberMatch.range, in: source) else { 103 | continue 104 | } 105 | 106 | let token = generator.tokenTransformer(swiftRange) 107 | tokens.append(token) 108 | 109 | } 110 | 111 | return tokens 112 | } 113 | 114 | } 115 | -------------------------------------------------------------------------------- /LibXlsxWriterSwiftSample/Examples/tutorial3.swift: -------------------------------------------------------------------------------- 1 | // 2 | // tutorial3.swift 3 | // LibXlsxWriterSwiftSample 4 | // 5 | import Foundation 6 | import xlsxwriter 7 | 8 | class Tutorial3{ 9 | let expenses = [ 10 | Expense(item: "Rent", cost: 1000, datetime: lxw_datetime(year: 2013, month: 1, day: 13, hour: 0, min: 0, sec: 0.0)), 11 | Expense(item: "Gas", cost: 100, datetime: lxw_datetime(year: 2013, month: 1, day: 14, hour: 0, min: 0, sec: 0.0)), 12 | Expense(item: "Food", cost: 300, datetime: lxw_datetime(year: 2013, month: 1, day: 16, hour: 0, min: 0, sec: 0.0)), 13 | Expense(item: "Gym", cost: 50, datetime: lxw_datetime(year: 2013, month: 1, day: 20, hour: 0, min: 0, sec: 0.0)), 14 | ] 15 | 16 | func generate() -> URL { 17 | let documentDirectory = try! FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor:nil, create:false) 18 | let fileURL = documentDirectory.appendingPathComponent("tutorial03.xlsx") 19 | 20 | //Create a new workbook. 21 | //Ditch first 6 characters, because they are of the form file:// 22 | let workbook = workbook_new((fileURL.absoluteString.dropFirst(6) as NSString).fileSystemRepresentation) 23 | 24 | let worksheet = workbook_add_worksheet(workbook, nil) 25 | 26 | //Add a bold format to use to highlight cells 27 | let bold = workbook_add_format(workbook) 28 | format_set_bold(bold); 29 | //Add a number format for cells with money. 30 | let money = workbook_add_format(workbook) 31 | format_set_num_format(money, "$#,##0") 32 | //Add an Excel date format. 33 | let date_format = workbook_add_format(workbook) 34 | format_set_num_format(date_format, "mmmm d yyyy") 35 | 36 | //Adjust the column width. 37 | worksheet_set_column(worksheet, 1, 1, 15, nil) 38 | 39 | //Write some data header. 40 | worksheet_write_string(worksheet, 0, 0, "Item", bold) 41 | worksheet_write_string(worksheet, 0, 1, "Date", bold) 42 | worksheet_write_string(worksheet, 0, 2, "Cost", bold) 43 | 44 | //Start from the first cell. Rows and columns are zero indexed. 45 | var row = 0 46 | let col = 0 47 | //Iterate over the data and write it out element by element. 48 | for row in (0...3).reversed() { 49 | var datetime = expenses[row].datetime! 50 | //Write from the first cell below the headers. 51 | worksheet_write_string(worksheet, lxw_row_t(row+1), lxw_col_t(col), expenses[row].item, nil) 52 | worksheet_write_datetime(worksheet, lxw_row_t(row+1), lxw_col_t(col + 1), &datetime, date_format) 53 | worksheet_write_number(worksheet, lxw_row_t(row+1), lxw_col_t(col + 2), expenses[row].cost, money) 54 | } 55 | row = 5 56 | //Write a total using a formula. 57 | worksheet_write_string (worksheet, lxw_row_t(row), lxw_col_t(col), "Total", bold) 58 | worksheet_write_formula(worksheet, lxw_row_t(row), lxw_col_t(col + 2), "=SUM(C2:C5)", money) 59 | workbook_close(workbook) 60 | return fileURL 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /LibXlsxWriterSwiftSample/Examples/format_num_format.swift: -------------------------------------------------------------------------------- 1 | // 2 | // format_num_format.swift 3 | // LibXlsxWriterSwiftSample 4 | // 5 | 6 | import Foundation 7 | import xlsxwriter 8 | 9 | class FormatNumFormat{ 10 | func generate() -> URL { 11 | let documentDirectory = try! FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor:nil, create:false) 12 | let fileURL = documentDirectory.appendingPathComponent("format_num_format.xlsx") 13 | 14 | let workbook = workbook_new((fileURL.absoluteString.dropFirst(6) as NSString).fileSystemRepresentation) 15 | let worksheet = workbook_add_worksheet(workbook, nil) 16 | //Widen the first column to make the text clearer 17 | worksheet_set_column(worksheet, 0, 0, 30, nil) 18 | //Add some formats 19 | let format01 = workbook_add_format(workbook) 20 | let format02 = workbook_add_format(workbook) 21 | let format03 = workbook_add_format(workbook) 22 | let format04 = workbook_add_format(workbook) 23 | let format05 = workbook_add_format(workbook) 24 | let format06 = workbook_add_format(workbook) 25 | let format07 = workbook_add_format(workbook) 26 | let format08 = workbook_add_format(workbook) 27 | let format09 = workbook_add_format(workbook) 28 | let format10 = workbook_add_format(workbook) 29 | let format11 = workbook_add_format(workbook) 30 | //Set some example number formats 31 | format_set_num_format(format01, "0.000") 32 | format_set_num_format(format02, "#,##0") 33 | format_set_num_format(format03, "#,##0.00") 34 | format_set_num_format(format04, "0.00") 35 | format_set_num_format(format05, "mm/dd/yy") 36 | format_set_num_format(format06, "mmm d yyyy") 37 | format_set_num_format(format07, "d mmmm yyyy") 38 | format_set_num_format(format08, "dd/mm/yyyy hh:mm AM/PM") 39 | format_set_num_format(format09, "0 \"dollar and\" .00 \"cents\"") 40 | //Write data using the formats 41 | worksheet_write_number(worksheet, 0, 0, 3.1415926, nil) // 3.1415926 42 | worksheet_write_number(worksheet, 1, 0, 3.1415926, format01) // 3.142 43 | worksheet_write_number(worksheet, 2, 0, 1234.56, format02) // 1,235 44 | worksheet_write_number(worksheet, 3, 0, 1234.56, format03) // 1,234.56 45 | worksheet_write_number(worksheet, 4, 0, 49.99, format04) // 49.99 46 | worksheet_write_number(worksheet, 5, 0, 36892.521, format05) // 01/01/01 47 | worksheet_write_number(worksheet, 6, 0, 36892.521, format06) // Jan 1 2001 48 | worksheet_write_number(worksheet, 7, 0, 36892.521, format07) // 1 January 2001 49 | worksheet_write_number(worksheet, 8, 0, 36892.521, format08) // 01/01/2001 12:30 AM 50 | worksheet_write_number(worksheet, 9, 0, 1.87, format09) // 1 dollar and .87 cents 51 | //Show limited conditional number formats 52 | format_set_num_format(format10, "[Green]General[Red]-GeneralGeneral") 53 | worksheet_write_number(worksheet, 10, 0, 123, format10) // > 0 Green 54 | worksheet_write_number(worksheet, 11, 0, -45, format10) // < 0 Red 55 | worksheet_write_number(worksheet, 12, 0, 0, format10) // = 0 Default color 56 | //Format a Zip code 57 | format_set_num_format(format11, "00000") 58 | worksheet_write_number(worksheet, 13, 0, 1209, format11) 59 | workbook_close(workbook) 60 | 61 | return fileURL 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Libxlsxwriter Swift Samples are released under a FreeBSD license: 2 | 3 | Copyright 2020, FrankenApps 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are 8 | met: 9 | 10 | 1. Redistributions of source code must retain the above copyright notice, 11 | this list of conditions and the following disclaimer. 12 | 2. Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 17 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 18 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 20 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 24 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 25 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | 28 | The views and conclusions contained in the software and documentation are 29 | those of the authors and should not be interpreted as representing 30 | official policies, either expressed or implied, of the FreeBSD Project. 31 | 32 | 33 | Libxlsxwriter Swift Samples are based on the examples from the libxlsxwriter library which are released under a FreeBSD license: 34 | 35 | Copyright 2014-2020, John McNamara 36 | All rights reserved. 37 | 38 | Redistribution and use in source and binary forms, with or without 39 | modification, are permitted provided that the following conditions are 40 | met: 41 | 42 | 1. Redistributions of source code must retain the above copyright notice, 43 | this list of conditions and the following disclaimer. 44 | 2. Redistributions in binary form must reproduce the above copyright 45 | notice, this list of conditions and the following disclaimer in the 46 | documentation and/or other materials provided with the distribution. 47 | 48 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 49 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 50 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 51 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 52 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 53 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 54 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 55 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 56 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 57 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 58 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 59 | 60 | The views and conclusions contained in the software and documentation are 61 | those of the authors and should not be interpreted as representing 62 | official policies, either expressed or implied, of the FreeBSD Project. 63 | -------------------------------------------------------------------------------- /Pods/Sourceful/Sources/Languages/SwiftLexer.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SwiftLexer.swift 3 | // SourceEditor 4 | // 5 | // Created by Louis D'hauwe on 24/07/2018. 6 | // Copyright © 2018 Silver Fox. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public class SwiftLexer: SourceCodeRegexLexer { 12 | 13 | public init() { 14 | 15 | } 16 | 17 | lazy var generators: [TokenGenerator] = { 18 | 19 | var generators = [TokenGenerator?]() 20 | 21 | // UI/App Kit 22 | generators.append(regexGenerator("\\b(NS|UI)[A-Z][a-zA-Z]+\\b", tokenType: .identifier)) 23 | 24 | // Functions 25 | 26 | generators.append(regexGenerator("\\b(println|print)(?=\\()", tokenType: .identifier)) 27 | 28 | generators.append(regexGenerator("(?<=(\\s|\\[|,|:))(\\d|\\.|_)+", tokenType: .number)) 29 | 30 | generators.append(regexGenerator("\\.[A-Za-z_]+\\w*", tokenType: .identifier)) 31 | 32 | let keywords = "as associatedtype break case catch class continue convenience default defer deinit else enum extension fallthrough false fileprivate final for func get guard if import in init inout internal is lazy let mutating nil nonmutating open operator override private protocol public repeat required rethrows return required self set static struct subscript super switch throw throws true try typealias unowned var weak where while".components(separatedBy: " ") 33 | 34 | generators.append(keywordGenerator(keywords, tokenType: .keyword)) 35 | 36 | let stdlibIdentifiers = "Any Array AutoreleasingUnsafePointer BidirectionalReverseView Bit Bool CFunctionPointer COpaquePointer CVaListPointer Character CollectionOfOne ConstUnsafePointer ContiguousArray Data Dictionary DictionaryGenerator DictionaryIndex Double EmptyCollection EmptyGenerator EnumerateGenerator FilterCollectionView FilterCollectionViewIndex FilterGenerator FilterSequenceView Float Float80 FloatingPointClassification GeneratorOf GeneratorOfOne GeneratorSequence HeapBuffer HeapBuffer HeapBufferStorage HeapBufferStorageBase ImplicitlyUnwrappedOptional IndexingGenerator Int Int16 Int32 Int64 Int8 IntEncoder LazyBidirectionalCollection LazyForwardCollection LazyRandomAccessCollection LazySequence Less MapCollectionView MapSequenceGenerator MapSequenceView MirrorDisposition ObjectIdentifier OnHeap Optional PermutationGenerator QuickLookObject RandomAccessReverseView Range RangeGenerator RawByte Repeat ReverseBidirectionalIndex Printable ReverseRandomAccessIndex SequenceOf SinkOf Slice StaticString StrideThrough StrideThroughGenerator StrideTo StrideToGenerator String Index UTF8View Index UnicodeScalarView IndexType GeneratorType UTF16View UInt UInt16 UInt32 UInt64 UInt8 UTF16 UTF32 UTF8 UnicodeDecodingResult UnicodeScalar Unmanaged UnsafeArray UnsafeArrayGenerator UnsafeMutableArray UnsafePointer VaListBuilder Header Zip2 ZipGenerator2".components(separatedBy: " ") 37 | 38 | generators.append(keywordGenerator(stdlibIdentifiers, tokenType: .identifier)) 39 | 40 | // Line comment 41 | generators.append(regexGenerator("//(.*)", tokenType: .comment)) 42 | 43 | // Block comment 44 | generators.append(regexGenerator("(/\\*)(.*)(\\*/)", options: [.dotMatchesLineSeparators], tokenType: .comment)) 45 | 46 | // Single-line string literal 47 | generators.append(regexGenerator("(\"|@\")[^\"\\n]*(@\"|\")", tokenType: .string)) 48 | 49 | // Multi-line string literal 50 | generators.append(regexGenerator("(\"\"\")(.*?)(\"\"\")", options: [.dotMatchesLineSeparators], tokenType: .string)) 51 | 52 | // Editor placeholder 53 | var editorPlaceholderPattern = "(<#)[^\"\\n]*" 54 | editorPlaceholderPattern += "(#>)" 55 | generators.append(regexGenerator(editorPlaceholderPattern, tokenType: .editorPlaceholder)) 56 | 57 | return generators.compactMap( { $0 }) 58 | }() 59 | 60 | public func generators(source: String) -> [TokenGenerator] { 61 | return generators 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /Pods/Sourceful/Sources/View/InnerTextView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // InnerTextView.swift 3 | // SavannaKit 4 | // 5 | // Created by Louis D'hauwe on 09/07/2017. 6 | // Copyright © 2017 Silver Fox. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import CoreGraphics 11 | 12 | #if os(macOS) 13 | import AppKit 14 | #else 15 | import UIKit 16 | #endif 17 | 18 | protocol InnerTextViewDelegate: class { 19 | func didUpdateCursorFloatingState() 20 | } 21 | 22 | class InnerTextView: TextView { 23 | 24 | weak var innerDelegate: InnerTextViewDelegate? 25 | 26 | var theme: SyntaxColorTheme? 27 | 28 | var cachedParagraphs: [Paragraph]? 29 | 30 | func invalidateCachedParagraphs() { 31 | cachedParagraphs = nil 32 | } 33 | 34 | func hideGutter() { 35 | gutterWidth = theme?.gutterStyle.minimumWidth ?? 0.0 36 | } 37 | 38 | func updateGutterWidth(for numberOfCharacters: Int) { 39 | 40 | let leftInset: CGFloat = 4.0 41 | let rightInset: CGFloat = 4.0 42 | 43 | let charWidth: CGFloat = 10.0 44 | 45 | gutterWidth = max(theme?.gutterStyle.minimumWidth ?? 0.0, CGFloat(numberOfCharacters) * charWidth + leftInset + rightInset) 46 | 47 | } 48 | 49 | #if os(iOS) 50 | 51 | var isCursorFloating = false 52 | 53 | override func beginFloatingCursor(at point: CGPoint) { 54 | super.beginFloatingCursor(at: point) 55 | 56 | isCursorFloating = true 57 | innerDelegate?.didUpdateCursorFloatingState() 58 | 59 | } 60 | 61 | override func endFloatingCursor() { 62 | super.endFloatingCursor() 63 | 64 | isCursorFloating = false 65 | innerDelegate?.didUpdateCursorFloatingState() 66 | 67 | } 68 | 69 | override public func draw(_ rect: CGRect) { 70 | 71 | guard let theme = theme else { 72 | super.draw(rect) 73 | hideGutter() 74 | return 75 | } 76 | 77 | let textView = self 78 | 79 | if theme.lineNumbersStyle == nil { 80 | 81 | hideGutter() 82 | 83 | let gutterRect = CGRect(x: 0, y: rect.minY, width: textView.gutterWidth, height: rect.height) 84 | let path = BezierPath(rect: gutterRect) 85 | path.fill() 86 | 87 | } else { 88 | 89 | let components = textView.text.components(separatedBy: .newlines) 90 | 91 | let count = components.count 92 | 93 | let maxNumberOfDigits = "\(count)".count 94 | 95 | textView.updateGutterWidth(for: maxNumberOfDigits) 96 | 97 | var paragraphs: [Paragraph] 98 | 99 | if let cached = textView.cachedParagraphs { 100 | 101 | paragraphs = cached 102 | 103 | } else { 104 | 105 | paragraphs = generateParagraphs(for: textView, flipRects: false) 106 | textView.cachedParagraphs = paragraphs 107 | 108 | } 109 | 110 | theme.gutterStyle.backgroundColor.setFill() 111 | 112 | let gutterRect = CGRect(x: 0, y: rect.minY, width: textView.gutterWidth, height: rect.height) 113 | let path = BezierPath(rect: gutterRect) 114 | path.fill() 115 | 116 | drawLineNumbers(paragraphs, in: rect, for: self) 117 | 118 | } 119 | 120 | 121 | super.draw(rect) 122 | 123 | } 124 | #endif 125 | 126 | var gutterWidth: CGFloat { 127 | set { 128 | 129 | #if os(macOS) 130 | textContainerInset = NSSize(width: newValue, height: 0) 131 | #else 132 | textContainerInset = UIEdgeInsets(top: 0, left: newValue, bottom: 0, right: 0) 133 | #endif 134 | 135 | } 136 | get { 137 | 138 | #if os(macOS) 139 | return textContainerInset.width 140 | #else 141 | return textContainerInset.left 142 | #endif 143 | 144 | } 145 | } 146 | // var gutterWidth: CGFloat = 0.0 { 147 | // didSet { 148 | // 149 | // textContainer.exclusionPaths = [UIBezierPath(rect: CGRect(x: 0.0, y: 0.0, width: gutterWidth, height: .greatestFiniteMagnitude))] 150 | // 151 | // } 152 | // 153 | // } 154 | 155 | #if os(iOS) 156 | 157 | override func caretRect(for position: UITextPosition) -> CGRect { 158 | 159 | var superRect = super.caretRect(for: position) 160 | 161 | guard let theme = theme else { 162 | return superRect 163 | } 164 | 165 | let font = theme.font 166 | 167 | // "descender" is expressed as a negative value, 168 | // so to add its height you must subtract its value 169 | superRect.size.height = font.pointSize - font.descender 170 | 171 | return superRect 172 | } 173 | 174 | #endif 175 | 176 | } 177 | -------------------------------------------------------------------------------- /Pods/Sourceful/Sources/View/Paragraphs.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Paragraphs.swift 3 | // SavannaKit 4 | // 5 | // Created by Louis D'hauwe on 17/02/2018. 6 | // Copyright © 2018 Silver Fox. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | #if os(macOS) 12 | import AppKit 13 | #else 14 | import UIKit 15 | #endif 16 | 17 | extension TextView { 18 | 19 | func paragraphRectForRange(range: NSRange) -> CGRect { 20 | 21 | var nsRange = range 22 | 23 | let layoutManager: NSLayoutManager 24 | let textContainer: NSTextContainer 25 | #if os(macOS) 26 | layoutManager = self.layoutManager! 27 | textContainer = self.textContainer! 28 | #else 29 | layoutManager = self.layoutManager 30 | textContainer = self.textContainer 31 | #endif 32 | 33 | nsRange = layoutManager.glyphRange(forCharacterRange: nsRange, actualCharacterRange: nil) 34 | 35 | var sectionRect = layoutManager.boundingRect(forGlyphRange: nsRange, in: textContainer) 36 | 37 | // FIXME: don't use this hack 38 | // This gets triggered for the final paragraph in a textview if the next line is empty (so the last paragraph ends with a newline) 39 | if sectionRect.origin.x == 0 { 40 | sectionRect.size.height -= 22 41 | } 42 | 43 | sectionRect.origin.x = 0 44 | 45 | return sectionRect 46 | } 47 | 48 | } 49 | 50 | func generateParagraphs(for textView: InnerTextView, flipRects: Bool = false) -> [Paragraph] { 51 | 52 | let range = NSRange(location: 0, length: (textView.text as NSString).length) 53 | 54 | var paragraphs = [Paragraph]() 55 | var i = 0 56 | 57 | (textView.text as NSString).enumerateSubstrings(in: range, options: [.byParagraphs]) { (paragraphContent, paragraphRange, enclosingRange, stop) in 58 | 59 | i += 1 60 | 61 | let rect = textView.paragraphRectForRange(range: paragraphRange) 62 | 63 | let paragraph = Paragraph(rect: rect, number: i) 64 | paragraphs.append(paragraph) 65 | 66 | } 67 | 68 | if textView.text.isEmpty || textView.text.hasSuffix("\n") { 69 | 70 | var rect: CGRect 71 | 72 | #if os(macOS) 73 | let gutterWidth = textView.textContainerInset.width 74 | #else 75 | let gutterWidth = textView.textContainerInset.left 76 | #endif 77 | 78 | let lineHeight: CGFloat = 18 79 | 80 | if let last = paragraphs.last { 81 | 82 | // FIXME: don't use hardcoded "2" as line spacing 83 | rect = CGRect(x: 0, y: last.rect.origin.y + last.rect.height + 2, width: gutterWidth, height: last.rect.height) 84 | 85 | } else { 86 | 87 | rect = CGRect(x: 0, y: 0, width: gutterWidth, height: lineHeight) 88 | 89 | } 90 | 91 | 92 | i += 1 93 | let endParagraph = Paragraph(rect: rect, number: i) 94 | paragraphs.append(endParagraph) 95 | 96 | } 97 | 98 | 99 | if flipRects { 100 | 101 | paragraphs = paragraphs.map { (p) -> Paragraph in 102 | 103 | var p = p 104 | p.rect.origin.y = textView.bounds.height - p.rect.height - p.rect.origin.y 105 | 106 | return p 107 | } 108 | 109 | } 110 | 111 | return paragraphs 112 | } 113 | 114 | func offsetParagraphs(_ paragraphs: [Paragraph], for textView: InnerTextView, yOffset: CGFloat = 0) -> [Paragraph] { 115 | 116 | var paragraphs = paragraphs 117 | 118 | #if os(macOS) 119 | 120 | if let yOffset = textView.enclosingScrollView?.contentView.bounds.origin.y { 121 | 122 | paragraphs = paragraphs.map { (p) -> Paragraph in 123 | 124 | var p = p 125 | p.rect.origin.y += yOffset 126 | 127 | return p 128 | } 129 | } 130 | 131 | 132 | #endif 133 | 134 | 135 | 136 | paragraphs = paragraphs.map { (p) -> Paragraph in 137 | 138 | var p = p 139 | p.rect.origin.y += yOffset 140 | return p 141 | } 142 | 143 | return paragraphs 144 | } 145 | 146 | func drawLineNumbers(_ paragraphs: [Paragraph], in rect: CGRect, for textView: InnerTextView) { 147 | 148 | guard let style = textView.theme?.lineNumbersStyle else { 149 | return 150 | } 151 | 152 | for paragraph in paragraphs { 153 | 154 | guard paragraph.rect.intersects(rect) else { 155 | continue 156 | } 157 | 158 | let attr = paragraph.attributedString(for: style) 159 | 160 | var drawRect = paragraph.rect 161 | 162 | let gutterWidth = textView.gutterWidth 163 | 164 | let drawSize = attr.size() 165 | 166 | drawRect.origin.x = gutterWidth - drawSize.width - 4 167 | 168 | #if os(macOS) 169 | // drawRect.origin.y += (drawRect.height - drawSize.height) / 2.0 170 | #else 171 | // drawRect.origin.y += 22 - drawSize.height 172 | #endif 173 | drawRect.size.width = drawSize.width 174 | drawRect.size.height = drawSize.height 175 | 176 | // Color.red.withAlphaComponent(0.4).setFill() 177 | // paragraph.rect.fill() 178 | 179 | attr.draw(in: drawRect) 180 | 181 | } 182 | 183 | } 184 | -------------------------------------------------------------------------------- /Pods/libxlsxwriter/third_party/minizip/crypt.h: -------------------------------------------------------------------------------- 1 | /* crypt.h -- base code for crypt/uncrypt ZIPfile 2 | 3 | 4 | Version 1.01e, February 12th, 2005 5 | 6 | Copyright (C) 1998-2005 Gilles Vollant 7 | 8 | This code is a modified version of crypting code in Infozip distribution 9 | 10 | The encryption/decryption parts of this source code (as opposed to the 11 | non-echoing password parts) were originally written in Europe. The 12 | whole source package can be freely distributed, including from the USA. 13 | (Prior to January 2000, re-export from the US was a violation of US law.) 14 | 15 | This encryption code is a direct transcription of the algorithm from 16 | Roger Schlafly, described by Phil Katz in the file appnote.txt. This 17 | file (appnote.txt) is distributed with the PKZIP program (even in the 18 | version without encryption capabilities). 19 | 20 | If you don't need crypting in your application, just define symbols 21 | NOCRYPT and NOUNCRYPT. 22 | 23 | This code support the "Traditional PKWARE Encryption". 24 | 25 | The new AES encryption added on Zip format by Winzip (see the page 26 | http://www.winzip.com/aes_info.htm ) and PKWare PKZip 5.x Strong 27 | Encryption is not supported. 28 | */ 29 | 30 | #define CRC32(c, b) ((*(pcrc_32_tab+(((int)(c) ^ (b)) & 0xff))) ^ ((c) >> 8)) 31 | 32 | /*********************************************************************** 33 | * Return the next byte in the pseudo-random sequence 34 | */ 35 | static int decrypt_byte(unsigned long* pkeys, const z_crc_t* pcrc_32_tab) 36 | { 37 | unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an 38 | * unpredictable manner on 16-bit systems; not a problem 39 | * with any known compiler so far, though */ 40 | 41 | temp = ((unsigned)(*(pkeys+2)) & 0xffff) | 2; 42 | return (int)(((temp * (temp ^ 1)) >> 8) & 0xff); 43 | } 44 | 45 | /*********************************************************************** 46 | * Update the encryption keys with the next byte of plain text 47 | */ 48 | static int update_keys(unsigned long* pkeys,const z_crc_t* pcrc_32_tab,int c) 49 | { 50 | (*(pkeys+0)) = CRC32((*(pkeys+0)), c); 51 | (*(pkeys+1)) += (*(pkeys+0)) & 0xff; 52 | (*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1; 53 | { 54 | register int keyshift = (int)((*(pkeys+1)) >> 24); 55 | (*(pkeys+2)) = CRC32((*(pkeys+2)), keyshift); 56 | } 57 | return c; 58 | } 59 | 60 | 61 | /*********************************************************************** 62 | * Initialize the encryption keys and the random header according to 63 | * the given password. 64 | */ 65 | static void init_keys(const char* passwd,unsigned long* pkeys,const z_crc_t* pcrc_32_tab) 66 | { 67 | *(pkeys+0) = 305419896L; 68 | *(pkeys+1) = 591751049L; 69 | *(pkeys+2) = 878082192L; 70 | while (*passwd != '\0') { 71 | update_keys(pkeys,pcrc_32_tab,(int)*passwd); 72 | passwd++; 73 | } 74 | } 75 | 76 | #define zdecode(pkeys,pcrc_32_tab,c) \ 77 | (update_keys(pkeys,pcrc_32_tab,c ^= decrypt_byte(pkeys,pcrc_32_tab))) 78 | 79 | #define zencode(pkeys,pcrc_32_tab,c,t) \ 80 | (t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), t^(c)) 81 | 82 | #ifdef INCLUDECRYPTINGCODE_IFCRYPTALLOWED 83 | 84 | #define RAND_HEAD_LEN 12 85 | /* "last resort" source for second part of crypt seed pattern */ 86 | # ifndef ZCR_SEED2 87 | # define ZCR_SEED2 3141592654UL /* use PI as default pattern */ 88 | # endif 89 | 90 | static int crypthead(const char* passwd, /* password string */ 91 | unsigned char* buf, /* where to write header */ 92 | int bufSize, 93 | unsigned long* pkeys, 94 | const z_crc_t* pcrc_32_tab, 95 | unsigned long crcForCrypting) 96 | { 97 | int n; /* index in random header */ 98 | int t; /* temporary */ 99 | int c; /* random byte */ 100 | unsigned char header[RAND_HEAD_LEN-2]; /* random header */ 101 | static unsigned calls = 0; /* ensure different random header each time */ 102 | 103 | if (bufSize> 7) & 0xff; 118 | header[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, c, t); 119 | } 120 | /* Encrypt random header (last two bytes is high word of crc) */ 121 | init_keys(passwd, pkeys, pcrc_32_tab); 122 | for (n = 0; n < RAND_HEAD_LEN-2; n++) 123 | { 124 | buf[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, header[n], t); 125 | } 126 | buf[n++] = (unsigned char)zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 16) & 0xff, t); 127 | buf[n++] = (unsigned char)zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 24) & 0xff, t); 128 | return n; 129 | } 130 | 131 | #endif 132 | -------------------------------------------------------------------------------- /Pods/libxlsxwriter/src/custom.c: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * custom - A library for creating Excel custom property files. 3 | * 4 | * Used in conjunction with the libxlsxwriter library. 5 | * 6 | * Copyright 2014-2021, John McNamara, jmcnamara@cpan.org. See LICENSE.txt. 7 | * 8 | */ 9 | 10 | #include "xlsxwriter/xmlwriter.h" 11 | #include "xlsxwriter/custom.h" 12 | #include "xlsxwriter/utility.h" 13 | 14 | /* 15 | * Forward declarations. 16 | */ 17 | 18 | /***************************************************************************** 19 | * 20 | * Private functions. 21 | * 22 | ****************************************************************************/ 23 | 24 | /* 25 | * Create a new custom object. 26 | */ 27 | lxw_custom * 28 | lxw_custom_new(void) 29 | { 30 | lxw_custom *custom = calloc(1, sizeof(lxw_custom)); 31 | GOTO_LABEL_ON_MEM_ERROR(custom, mem_error); 32 | 33 | return custom; 34 | 35 | mem_error: 36 | lxw_custom_free(custom); 37 | return NULL; 38 | } 39 | 40 | /* 41 | * Free a custom object. 42 | */ 43 | void 44 | lxw_custom_free(lxw_custom *custom) 45 | { 46 | if (!custom) 47 | return; 48 | 49 | free(custom); 50 | } 51 | 52 | /***************************************************************************** 53 | * 54 | * XML functions. 55 | * 56 | ****************************************************************************/ 57 | 58 | /* 59 | * Write the XML declaration. 60 | */ 61 | STATIC void 62 | _custom_xml_declaration(lxw_custom *self) 63 | { 64 | lxw_xml_declaration(self->file); 65 | } 66 | 67 | /* 68 | * Write the element. 69 | */ 70 | STATIC void 71 | _chart_write_vt_lpwstr(lxw_custom *self, char *value) 72 | { 73 | lxw_xml_data_element(self->file, "vt:lpwstr", value, NULL); 74 | } 75 | 76 | /* 77 | * Write the element. 78 | */ 79 | STATIC void 80 | _chart_write_vt_r_8(lxw_custom *self, double value) 81 | { 82 | char data[LXW_ATTR_32]; 83 | 84 | lxw_sprintf_dbl(data, value); 85 | 86 | lxw_xml_data_element(self->file, "vt:r8", data, NULL); 87 | } 88 | 89 | /* 90 | * Write the element. 91 | */ 92 | STATIC void 93 | _custom_write_vt_i_4(lxw_custom *self, int32_t value) 94 | { 95 | char data[LXW_ATTR_32]; 96 | 97 | lxw_snprintf(data, LXW_ATTR_32, "%d", value); 98 | 99 | lxw_xml_data_element(self->file, "vt:i4", data, NULL); 100 | } 101 | 102 | /* 103 | * Write the element. 104 | */ 105 | STATIC void 106 | _custom_write_vt_bool(lxw_custom *self, uint8_t value) 107 | { 108 | if (value) 109 | lxw_xml_data_element(self->file, "vt:bool", "true", NULL); 110 | else 111 | lxw_xml_data_element(self->file, "vt:bool", "false", NULL); 112 | } 113 | 114 | /* 115 | * Write the element. 116 | */ 117 | STATIC void 118 | _custom_write_vt_filetime(lxw_custom *self, lxw_datetime *datetime) 119 | { 120 | char data[LXW_DATETIME_LENGTH]; 121 | 122 | lxw_snprintf(data, LXW_DATETIME_LENGTH, "%4d-%02d-%02dT%02d:%02d:%02dZ", 123 | datetime->year, datetime->month, datetime->day, 124 | datetime->hour, datetime->min, (int) datetime->sec); 125 | 126 | lxw_xml_data_element(self->file, "vt:filetime", data, NULL); 127 | } 128 | 129 | /* 130 | * Write the element. 131 | */ 132 | STATIC void 133 | _chart_write_custom_property(lxw_custom *self, 134 | lxw_custom_property *custom_property) 135 | { 136 | struct xml_attribute_list attributes; 137 | struct xml_attribute *attribute; 138 | char fmtid[] = "{D5CDD505-2E9C-101B-9397-08002B2CF9AE}"; 139 | 140 | self->pid++; 141 | 142 | LXW_INIT_ATTRIBUTES(); 143 | LXW_PUSH_ATTRIBUTES_STR("fmtid", fmtid); 144 | LXW_PUSH_ATTRIBUTES_INT("pid", self->pid + 1); 145 | LXW_PUSH_ATTRIBUTES_STR("name", custom_property->name); 146 | 147 | lxw_xml_start_tag(self->file, "property", &attributes); 148 | 149 | if (custom_property->type == LXW_CUSTOM_STRING) { 150 | /* Write the vt:lpwstr element. */ 151 | _chart_write_vt_lpwstr(self, custom_property->u.string); 152 | } 153 | else if (custom_property->type == LXW_CUSTOM_DOUBLE) { 154 | /* Write the vt:r8 element. */ 155 | _chart_write_vt_r_8(self, custom_property->u.number); 156 | } 157 | else if (custom_property->type == LXW_CUSTOM_INTEGER) { 158 | /* Write the vt:i4 element. */ 159 | _custom_write_vt_i_4(self, custom_property->u.integer); 160 | } 161 | else if (custom_property->type == LXW_CUSTOM_BOOLEAN) { 162 | /* Write the vt:bool element. */ 163 | _custom_write_vt_bool(self, custom_property->u.boolean); 164 | } 165 | else if (custom_property->type == LXW_CUSTOM_DATETIME) { 166 | /* Write the vt:filetime element. */ 167 | _custom_write_vt_filetime(self, &custom_property->u.datetime); 168 | } 169 | 170 | lxw_xml_end_tag(self->file, "property"); 171 | 172 | LXW_FREE_ATTRIBUTES(); 173 | } 174 | 175 | /* 176 | * Write the element. 177 | */ 178 | STATIC void 179 | _write_custom_properties(lxw_custom *self) 180 | { 181 | struct xml_attribute_list attributes; 182 | struct xml_attribute *attribute; 183 | char xmlns[] = LXW_SCHEMA_OFFICEDOC "/custom-properties"; 184 | char xmlns_vt[] = LXW_SCHEMA_OFFICEDOC "/docPropsVTypes"; 185 | lxw_custom_property *custom_property; 186 | 187 | LXW_INIT_ATTRIBUTES(); 188 | LXW_PUSH_ATTRIBUTES_STR("xmlns", xmlns); 189 | LXW_PUSH_ATTRIBUTES_STR("xmlns:vt", xmlns_vt); 190 | 191 | lxw_xml_start_tag(self->file, "Properties", &attributes); 192 | 193 | STAILQ_FOREACH(custom_property, self->custom_properties, list_pointers) { 194 | _chart_write_custom_property(self, custom_property); 195 | } 196 | 197 | LXW_FREE_ATTRIBUTES(); 198 | } 199 | 200 | /***************************************************************************** 201 | * 202 | * XML file assembly functions. 203 | * 204 | ****************************************************************************/ 205 | 206 | /* 207 | * Assemble and write the XML file. 208 | */ 209 | void 210 | lxw_custom_assemble_xml_file(lxw_custom *self) 211 | { 212 | /* Write the XML declaration. */ 213 | _custom_xml_declaration(self); 214 | 215 | _write_custom_properties(self); 216 | 217 | lxw_xml_end_tag(self->file, "Properties"); 218 | } 219 | 220 | /***************************************************************************** 221 | * 222 | * Public functions. 223 | * 224 | ****************************************************************************/ 225 | -------------------------------------------------------------------------------- /Pods/libxlsxwriter/include/xlsxwriter/xmlwriter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libxlsxwriter 3 | * 4 | * Copyright 2014-2021, John McNamara, jmcnamara@cpan.org. See LICENSE.txt. 5 | * 6 | * xmlwriter - A libxlsxwriter library for creating Excel XLSX 7 | * XML files. 8 | * 9 | * The xmlwriter library is used to create the XML sub-components files 10 | * in the Excel XLSX file format. 11 | * 12 | * This library is used in preference to a more generic XML library to allow 13 | * for customization and optimization for the XLSX file format. 14 | * 15 | * The xmlwriter functions are only used internally and do not need to be 16 | * called directly by the end user. 17 | * 18 | */ 19 | #ifndef __XMLWRITER_H__ 20 | #define __XMLWRITER_H__ 21 | 22 | #include 23 | #include 24 | #include 25 | #include "utility.h" 26 | 27 | #define LXW_MAX_ATTRIBUTE_LENGTH 2080 /* Max URL length. */ 28 | #define LXW_ATTR_32 32 29 | 30 | #define LXW_ATTRIBUTE_COPY(dst, src) \ 31 | do{ \ 32 | strncpy(dst, src, LXW_MAX_ATTRIBUTE_LENGTH -1); \ 33 | dst[LXW_MAX_ATTRIBUTE_LENGTH - 1] = '\0'; \ 34 | } while (0) 35 | 36 | 37 | /* *INDENT-OFF* */ 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | /* *INDENT-ON* */ 42 | 43 | /* Attribute used in XML elements. */ 44 | struct xml_attribute { 45 | char key[LXW_MAX_ATTRIBUTE_LENGTH]; 46 | char value[LXW_MAX_ATTRIBUTE_LENGTH]; 47 | 48 | /* Make the struct a queue.h list element. */ 49 | STAILQ_ENTRY (xml_attribute) list_entries; 50 | }; 51 | 52 | /* Use queue.h macros to define the xml_attribute_list type. */ 53 | STAILQ_HEAD(xml_attribute_list, xml_attribute); 54 | 55 | /* Create a new attribute struct to add to a xml_attribute_list. */ 56 | struct xml_attribute *lxw_new_attribute_str(const char *key, 57 | const char *value); 58 | struct xml_attribute *lxw_new_attribute_int(const char *key, uint32_t value); 59 | struct xml_attribute *lxw_new_attribute_dbl(const char *key, double value); 60 | 61 | /* Macro to initialize the xml_attribute_list pointers. */ 62 | #define LXW_INIT_ATTRIBUTES() \ 63 | STAILQ_INIT(&attributes) 64 | 65 | /* Macro to add attribute string elements to xml_attribute_list. */ 66 | #define LXW_PUSH_ATTRIBUTES_STR(key, value) \ 67 | do { \ 68 | attribute = lxw_new_attribute_str((key), (value)); \ 69 | STAILQ_INSERT_TAIL(&attributes, attribute, list_entries); \ 70 | } while (0) 71 | 72 | /* Macro to add attribute int values to xml_attribute_list. */ 73 | #define LXW_PUSH_ATTRIBUTES_INT(key, value) \ 74 | do { \ 75 | attribute = lxw_new_attribute_int((key), (value)); \ 76 | STAILQ_INSERT_TAIL(&attributes, attribute, list_entries); \ 77 | } while (0) 78 | 79 | /* Macro to add attribute double values to xml_attribute_list. */ 80 | #define LXW_PUSH_ATTRIBUTES_DBL(key, value) \ 81 | do { \ 82 | attribute = lxw_new_attribute_dbl((key), (value)); \ 83 | STAILQ_INSERT_TAIL(&attributes, attribute, list_entries); \ 84 | } while (0) 85 | 86 | /* Macro to free xml_attribute_list and attribute. */ 87 | #define LXW_FREE_ATTRIBUTES() \ 88 | do { \ 89 | while (!STAILQ_EMPTY(&attributes)) { \ 90 | attribute = STAILQ_FIRST(&attributes); \ 91 | STAILQ_REMOVE_HEAD(&attributes, list_entries); \ 92 | free(attribute); \ 93 | } \ 94 | } while (0) 95 | 96 | /** 97 | * Create the XML declaration in an XML file. 98 | * 99 | * @param xmlfile A FILE pointer to the output XML file. 100 | */ 101 | void lxw_xml_declaration(FILE * xmlfile); 102 | 103 | /** 104 | * Write an XML start tag with optional attributes. 105 | * 106 | * @param xmlfile A FILE pointer to the output XML file. 107 | * @param tag The XML tag to write. 108 | * @param attributes An optional list of attributes to add to the tag. 109 | */ 110 | void lxw_xml_start_tag(FILE * xmlfile, 111 | const char *tag, 112 | struct xml_attribute_list *attributes); 113 | 114 | /** 115 | * Write an XML start tag with optional un-encoded attributes. 116 | * This is a minor optimization for attributes that don't need encoding. 117 | * 118 | * @param xmlfile A FILE pointer to the output XML file. 119 | * @param tag The XML tag to write. 120 | * @param attributes An optional list of attributes to add to the tag. 121 | */ 122 | void lxw_xml_start_tag_unencoded(FILE * xmlfile, 123 | const char *tag, 124 | struct xml_attribute_list *attributes); 125 | 126 | /** 127 | * Write an XML end tag. 128 | * 129 | * @param xmlfile A FILE pointer to the output XML file. 130 | * @param tag The XML tag to write. 131 | */ 132 | void lxw_xml_end_tag(FILE * xmlfile, const char *tag); 133 | 134 | /** 135 | * Write an XML empty tag with optional attributes. 136 | * 137 | * @param xmlfile A FILE pointer to the output XML file. 138 | * @param tag The XML tag to write. 139 | * @param attributes An optional list of attributes to add to the tag. 140 | */ 141 | void lxw_xml_empty_tag(FILE * xmlfile, 142 | const char *tag, 143 | struct xml_attribute_list *attributes); 144 | 145 | /** 146 | * Write an XML empty tag with optional un-encoded attributes. 147 | * This is a minor optimization for attributes that don't need encoding. 148 | * 149 | * @param xmlfile A FILE pointer to the output XML file. 150 | * @param tag The XML tag to write. 151 | * @param attributes An optional list of attributes to add to the tag. 152 | */ 153 | void lxw_xml_empty_tag_unencoded(FILE * xmlfile, 154 | const char *tag, 155 | struct xml_attribute_list *attributes); 156 | 157 | /** 158 | * Write an XML element containing data and optional attributes. 159 | * 160 | * @param xmlfile A FILE pointer to the output XML file. 161 | * @param tag The XML tag to write. 162 | * @param data The data section of the XML element. 163 | * @param attributes An optional list of attributes to add to the tag. 164 | */ 165 | void lxw_xml_data_element(FILE * xmlfile, 166 | const char *tag, 167 | const char *data, 168 | struct xml_attribute_list *attributes); 169 | 170 | void lxw_xml_rich_si_element(FILE * xmlfile, const char *string); 171 | 172 | uint8_t lxw_has_control_characters(const char *string); 173 | char *lxw_escape_control_characters(const char *string); 174 | char *lxw_escape_url_characters(const char *string, uint8_t escape_hash); 175 | 176 | char *lxw_escape_data(const char *data); 177 | 178 | /* *INDENT-OFF* */ 179 | #ifdef __cplusplus 180 | } 181 | #endif 182 | /* *INDENT-ON* */ 183 | 184 | #endif /* __XMLWRITER_H__ */ 185 | -------------------------------------------------------------------------------- /Pods/libxlsxwriter/src/relationships.c: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * relationships - A library for creating Excel XLSX relationships files. 3 | * 4 | * Used in conjunction with the libxlsxwriter library. 5 | * 6 | * Copyright 2014-2021, John McNamara, jmcnamara@cpan.org. See LICENSE.txt. 7 | * 8 | */ 9 | 10 | #include 11 | #include "xlsxwriter/xmlwriter.h" 12 | #include "xlsxwriter/relationships.h" 13 | #include "xlsxwriter/utility.h" 14 | 15 | /* 16 | * Forward declarations. 17 | */ 18 | 19 | /***************************************************************************** 20 | * 21 | * Private functions. 22 | * 23 | ****************************************************************************/ 24 | 25 | /* 26 | * Create a new relationships object. 27 | */ 28 | lxw_relationships * 29 | lxw_relationships_new(void) 30 | { 31 | lxw_relationships *rels = calloc(1, sizeof(lxw_relationships)); 32 | GOTO_LABEL_ON_MEM_ERROR(rels, mem_error); 33 | 34 | rels->relationships = calloc(1, sizeof(struct lxw_rel_tuples)); 35 | GOTO_LABEL_ON_MEM_ERROR(rels->relationships, mem_error); 36 | STAILQ_INIT(rels->relationships); 37 | 38 | return rels; 39 | 40 | mem_error: 41 | lxw_free_relationships(rels); 42 | return NULL; 43 | } 44 | 45 | /* 46 | * Free a relationships object. 47 | */ 48 | void 49 | lxw_free_relationships(lxw_relationships *rels) 50 | { 51 | lxw_rel_tuple *relationship; 52 | 53 | if (!rels) 54 | return; 55 | 56 | if (rels->relationships) { 57 | while (!STAILQ_EMPTY(rels->relationships)) { 58 | relationship = STAILQ_FIRST(rels->relationships); 59 | STAILQ_REMOVE_HEAD(rels->relationships, list_pointers); 60 | free(relationship->type); 61 | free(relationship->target); 62 | free(relationship->target_mode); 63 | free(relationship); 64 | } 65 | 66 | free(rels->relationships); 67 | } 68 | 69 | free(rels); 70 | } 71 | 72 | /***************************************************************************** 73 | * 74 | * XML functions. 75 | * 76 | ****************************************************************************/ 77 | 78 | /* 79 | * Write the XML declaration. 80 | */ 81 | STATIC void 82 | _relationships_xml_declaration(lxw_relationships *self) 83 | { 84 | lxw_xml_declaration(self->file); 85 | } 86 | 87 | /* 88 | * Write the element. 89 | */ 90 | STATIC void 91 | _write_relationship(lxw_relationships *self, const char *type, 92 | const char *target, const char *target_mode) 93 | { 94 | struct xml_attribute_list attributes; 95 | struct xml_attribute *attribute; 96 | char r_id[LXW_MAX_ATTRIBUTE_LENGTH] = { 0 }; 97 | 98 | self->rel_id++; 99 | lxw_snprintf(r_id, LXW_ATTR_32, "rId%d", self->rel_id); 100 | 101 | LXW_INIT_ATTRIBUTES(); 102 | LXW_PUSH_ATTRIBUTES_STR("Id", r_id); 103 | LXW_PUSH_ATTRIBUTES_STR("Type", type); 104 | LXW_PUSH_ATTRIBUTES_STR("Target", target); 105 | 106 | if (target_mode) 107 | LXW_PUSH_ATTRIBUTES_STR("TargetMode", target_mode); 108 | 109 | lxw_xml_empty_tag(self->file, "Relationship", &attributes); 110 | 111 | LXW_FREE_ATTRIBUTES(); 112 | } 113 | 114 | /* 115 | * Write the element. 116 | */ 117 | STATIC void 118 | _write_relationships(lxw_relationships *self) 119 | { 120 | struct xml_attribute_list attributes; 121 | struct xml_attribute *attribute; 122 | lxw_rel_tuple *rel; 123 | 124 | LXW_INIT_ATTRIBUTES(); 125 | LXW_PUSH_ATTRIBUTES_STR("xmlns", LXW_SCHEMA_PACKAGE); 126 | 127 | lxw_xml_start_tag(self->file, "Relationships", &attributes); 128 | 129 | STAILQ_FOREACH(rel, self->relationships, list_pointers) { 130 | _write_relationship(self, rel->type, rel->target, rel->target_mode); 131 | } 132 | 133 | LXW_FREE_ATTRIBUTES(); 134 | } 135 | 136 | /***************************************************************************** 137 | * 138 | * XML file assembly functions. 139 | * 140 | ****************************************************************************/ 141 | 142 | /* 143 | * Assemble and write the XML file. 144 | */ 145 | void 146 | lxw_relationships_assemble_xml_file(lxw_relationships *self) 147 | { 148 | /* Write the XML declaration. */ 149 | _relationships_xml_declaration(self); 150 | 151 | _write_relationships(self); 152 | 153 | /* Close the relationships tag. */ 154 | lxw_xml_end_tag(self->file, "Relationships"); 155 | } 156 | 157 | /* 158 | * Add a generic container relationship to XLSX .rels xml files. 159 | */ 160 | STATIC void 161 | _add_relationship(lxw_relationships *self, const char *schema, 162 | const char *type, const char *target, 163 | const char *target_mode) 164 | { 165 | lxw_rel_tuple *relationship; 166 | 167 | if (!schema || !type || !target) 168 | return; 169 | 170 | relationship = calloc(1, sizeof(lxw_rel_tuple)); 171 | GOTO_LABEL_ON_MEM_ERROR(relationship, mem_error); 172 | 173 | relationship->type = calloc(1, LXW_MAX_ATTRIBUTE_LENGTH); 174 | GOTO_LABEL_ON_MEM_ERROR(relationship->type, mem_error); 175 | 176 | /* Add the schema to the relationship type. */ 177 | lxw_snprintf(relationship->type, LXW_MAX_ATTRIBUTE_LENGTH, "%s%s", 178 | schema, type); 179 | 180 | relationship->target = lxw_strdup(target); 181 | GOTO_LABEL_ON_MEM_ERROR(relationship->target, mem_error); 182 | 183 | if (target_mode) { 184 | relationship->target_mode = lxw_strdup(target_mode); 185 | GOTO_LABEL_ON_MEM_ERROR(relationship->target_mode, mem_error); 186 | } 187 | 188 | STAILQ_INSERT_TAIL(self->relationships, relationship, list_pointers); 189 | 190 | return; 191 | 192 | mem_error: 193 | if (relationship) { 194 | free(relationship->type); 195 | free(relationship->target); 196 | free(relationship->target_mode); 197 | free(relationship); 198 | } 199 | } 200 | 201 | /***************************************************************************** 202 | * 203 | * Public functions. 204 | * 205 | ****************************************************************************/ 206 | 207 | /* 208 | * Add a document relationship to XLSX .rels xml files. 209 | */ 210 | void 211 | lxw_add_document_relationship(lxw_relationships *self, const char *type, 212 | const char *target) 213 | { 214 | _add_relationship(self, LXW_SCHEMA_DOCUMENT, type, target, NULL); 215 | } 216 | 217 | /* 218 | * Add a package relationship to XLSX .rels xml files. 219 | */ 220 | void 221 | lxw_add_package_relationship(lxw_relationships *self, const char *type, 222 | const char *target) 223 | { 224 | _add_relationship(self, LXW_SCHEMA_PACKAGE, type, target, NULL); 225 | } 226 | 227 | /* 228 | * Add a MS schema package relationship to XLSX .rels xml files. 229 | */ 230 | void 231 | lxw_add_ms_package_relationship(lxw_relationships *self, const char *type, 232 | const char *target) 233 | { 234 | _add_relationship(self, LXW_SCHEMA_MS, type, target, NULL); 235 | } 236 | 237 | /* 238 | * Add a worksheet relationship to sheet .rels xml files. 239 | */ 240 | void 241 | lxw_add_worksheet_relationship(lxw_relationships *self, const char *type, 242 | const char *target, const char *target_mode) 243 | { 244 | _add_relationship(self, LXW_SCHEMA_DOCUMENT, type, target, target_mode); 245 | } 246 | -------------------------------------------------------------------------------- /Pods/libxlsxwriter/src/hash_table.c: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * hash_table - Hash table functions for libxlsxwriter. 3 | * 4 | * Used in conjunction with the libxlsxwriter library. 5 | * 6 | * Copyright 2014-2021, John McNamara, jmcnamara@cpan.org. See LICENSE.txt. 7 | * 8 | */ 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include "xlsxwriter/hash_table.h" 15 | 16 | /* 17 | * Calculate the hash key using the FNV function. See: 18 | * http://en.wikipedia.org/wiki/Fowler-Noll-Vo_hash_function 19 | */ 20 | STATIC size_t 21 | _generate_hash_key(void *data, size_t data_len, size_t num_buckets) 22 | { 23 | unsigned char *p = data; 24 | size_t hash = 2166136261U; 25 | size_t i; 26 | 27 | for (i = 0; i < data_len; i++) 28 | hash = (hash * 16777619) ^ p[i]; 29 | 30 | return hash % num_buckets; 31 | } 32 | 33 | /* 34 | * Check if an element exists in the hash table and return a pointer 35 | * to it if it does. 36 | */ 37 | lxw_hash_element * 38 | lxw_hash_key_exists(lxw_hash_table *lxw_hash, void *key, size_t key_len) 39 | { 40 | size_t hash_key = _generate_hash_key(key, key_len, lxw_hash->num_buckets); 41 | struct lxw_hash_bucket_list *list; 42 | lxw_hash_element *element; 43 | 44 | if (!lxw_hash->buckets[hash_key]) { 45 | /* The key isn't in the LXW_HASH hash table. */ 46 | return NULL; 47 | } 48 | else { 49 | /* The key is already in the table or there is a hash collision. */ 50 | list = lxw_hash->buckets[hash_key]; 51 | 52 | /* Iterate over the keys in the bucket's linked list. */ 53 | SLIST_FOREACH(element, list, lxw_hash_list_pointers) { 54 | if (memcmp(element->key, key, key_len) == 0) { 55 | /* The key already exists in the table. */ 56 | return element; 57 | } 58 | } 59 | 60 | /* Key doesn't exist in the list so this is a hash collision. */ 61 | return NULL; 62 | } 63 | } 64 | 65 | /* 66 | * Insert or update a value in the LXW_HASH table based on a key 67 | * and return a pointer to the new or updated element. 68 | */ 69 | lxw_hash_element * 70 | lxw_insert_hash_element(lxw_hash_table *lxw_hash, void *key, void *value, 71 | size_t key_len) 72 | { 73 | size_t hash_key = _generate_hash_key(key, key_len, lxw_hash->num_buckets); 74 | struct lxw_hash_bucket_list *list = NULL; 75 | lxw_hash_element *element = NULL; 76 | 77 | if (!lxw_hash->buckets[hash_key]) { 78 | /* The key isn't in the LXW_HASH hash table. */ 79 | 80 | /* Create a linked list in the bucket to hold the lxw_hash keys. */ 81 | list = calloc(1, sizeof(struct lxw_hash_bucket_list)); 82 | GOTO_LABEL_ON_MEM_ERROR(list, mem_error1); 83 | 84 | /* Initialize the bucket linked list. */ 85 | SLIST_INIT(list); 86 | 87 | /* Create an lxw_hash element to add to the linked list. */ 88 | element = calloc(1, sizeof(lxw_hash_element)); 89 | GOTO_LABEL_ON_MEM_ERROR(element, mem_error1); 90 | 91 | /* Store the key and value. */ 92 | element->key = key; 93 | element->value = value; 94 | 95 | /* Add the lxw_hash element to the bucket's linked list. */ 96 | SLIST_INSERT_HEAD(list, element, lxw_hash_list_pointers); 97 | 98 | /* Also add it to the insertion order linked list. */ 99 | STAILQ_INSERT_TAIL(lxw_hash->order_list, element, 100 | lxw_hash_order_pointers); 101 | 102 | /* Store the bucket list at the hash index. */ 103 | lxw_hash->buckets[hash_key] = list; 104 | 105 | lxw_hash->used_buckets++; 106 | lxw_hash->unique_count++; 107 | 108 | return element; 109 | } 110 | else { 111 | /* The key is already in the table or there is a hash collision. */ 112 | list = lxw_hash->buckets[hash_key]; 113 | 114 | /* Iterate over the keys in the bucket's linked list. */ 115 | SLIST_FOREACH(element, list, lxw_hash_list_pointers) { 116 | if (memcmp(element->key, key, key_len) == 0) { 117 | /* The key already exists in the table. Update the value. */ 118 | if (lxw_hash->free_value) 119 | free(element->value); 120 | 121 | element->value = value; 122 | return element; 123 | } 124 | } 125 | 126 | /* Key doesn't exist in the list so this is a hash collision. 127 | * Create an lxw_hash element to add to the linked list. */ 128 | element = calloc(1, sizeof(lxw_hash_element)); 129 | GOTO_LABEL_ON_MEM_ERROR(element, mem_error2); 130 | 131 | /* Store the key and value. */ 132 | element->key = key; 133 | element->value = value; 134 | 135 | /* Add the lxw_hash element to the bucket linked list. */ 136 | SLIST_INSERT_HEAD(list, element, lxw_hash_list_pointers); 137 | 138 | /* Also add it to the insertion order linked list. */ 139 | STAILQ_INSERT_TAIL(lxw_hash->order_list, element, 140 | lxw_hash_order_pointers); 141 | 142 | lxw_hash->unique_count++; 143 | 144 | return element; 145 | } 146 | 147 | mem_error1: 148 | free(list); 149 | 150 | mem_error2: 151 | free(element); 152 | return NULL; 153 | } 154 | 155 | /* 156 | * Create a new LXW_HASH hash table object. 157 | */ 158 | lxw_hash_table * 159 | lxw_hash_new(uint32_t num_buckets, uint8_t free_key, uint8_t free_value) 160 | { 161 | /* Create the new hash table. */ 162 | lxw_hash_table *lxw_hash = calloc(1, sizeof(lxw_hash_table)); 163 | RETURN_ON_MEM_ERROR(lxw_hash, NULL); 164 | 165 | lxw_hash->free_key = free_key; 166 | lxw_hash->free_value = free_value; 167 | 168 | /* Add the lxw_hash element buckets. */ 169 | lxw_hash->buckets = 170 | calloc(num_buckets, sizeof(struct lxw_hash_bucket_list *)); 171 | GOTO_LABEL_ON_MEM_ERROR(lxw_hash->buckets, mem_error); 172 | 173 | /* Add a list for tracking the insertion order. */ 174 | lxw_hash->order_list = calloc(1, sizeof(struct lxw_hash_order_list)); 175 | GOTO_LABEL_ON_MEM_ERROR(lxw_hash->order_list, mem_error); 176 | 177 | /* Initialize the order list. */ 178 | STAILQ_INIT(lxw_hash->order_list); 179 | 180 | /* Store the number of buckets to calculate the load factor. */ 181 | lxw_hash->num_buckets = num_buckets; 182 | 183 | return lxw_hash; 184 | 185 | mem_error: 186 | lxw_hash_free(lxw_hash); 187 | return NULL; 188 | } 189 | 190 | /* 191 | * Free the LXW_HASH hash table object. 192 | */ 193 | void 194 | lxw_hash_free(lxw_hash_table *lxw_hash) 195 | { 196 | size_t i; 197 | lxw_hash_element *element; 198 | lxw_hash_element *element_temp; 199 | 200 | if (!lxw_hash) 201 | return; 202 | 203 | /* Free the lxw_hash_elements and data using the ordered linked list. */ 204 | if (lxw_hash->order_list) { 205 | STAILQ_FOREACH_SAFE(element, lxw_hash->order_list, 206 | lxw_hash_order_pointers, element_temp) { 207 | if (lxw_hash->free_key) 208 | free(element->key); 209 | if (lxw_hash->free_value) 210 | free(element->value); 211 | free(element); 212 | } 213 | } 214 | 215 | /* Free the buckets from the hash table. */ 216 | for (i = 0; i < lxw_hash->num_buckets; i++) { 217 | free(lxw_hash->buckets[i]); 218 | } 219 | 220 | free(lxw_hash->order_list); 221 | free(lxw_hash->buckets); 222 | free(lxw_hash); 223 | } 224 | -------------------------------------------------------------------------------- /Pods/Sourceful/Sources/View/LineNumberLayoutManager.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LineNumberLayoutManager.swift 3 | // SavannaKit iOS 4 | // 5 | // Created by Louis D'hauwe on 04/05/2018. 6 | // Copyright © 2018 Silver Fox. All rights reserved. 7 | // 8 | // Currently unused in SavannaKit, but might be a better way of drawing the line numbers. 9 | // Converted from https://github.com/alldritt/TextKit_LineNumbers 10 | 11 | import Foundation 12 | 13 | #if os(macOS) 14 | import AppKit 15 | #else 16 | import UIKit 17 | #endif 18 | 19 | class LineNumberLayoutManager: NSLayoutManager { 20 | 21 | var lastParaLocation = 0 22 | var lastParaNumber = 0 23 | 24 | func _paraNumber(for charRange: NSRange) -> Int { 25 | // NSString does not provide a means of efficiently determining the paragraph number of a range of text. This code 26 | // attempts to optimize what would normally be a series linear searches by keeping track of the last paragraph number 27 | // found and uses that as the starting point for next paragraph number search. This works (mostly) because we 28 | // are generally asked for continguous increasing sequences of paragraph numbers. Also, this code is called in the 29 | // course of drawing a pagefull of text, and so even when moving back, the number of paragraphs to search for is 30 | // relativly low, even in really long bodies of text. 31 | // 32 | // This all falls down when the user edits the text, and can potentially invalidate the cached paragraph number which 33 | // causes a (potentially lengthy) search from the beginning of the string. 34 | if charRange.location == lastParaLocation { 35 | return lastParaNumber 36 | } else if charRange.location < lastParaLocation { 37 | // We need to look backwards from the last known paragraph for the new paragraph range. This generally happens 38 | // when the text in the UITextView scrolls downward, revaling paragraphs before/above the ones previously drawn. 39 | let s = textStorage?.string 40 | var paraNumber: Int = lastParaNumber 41 | (s as NSString?)?.enumerateSubstrings(in: NSRange(location: Int(charRange.location), length: Int(lastParaLocation - charRange.location)), options: [.byParagraphs, .substringNotRequired, .reverse], using: {(_ substring: String?, _ substringRange: NSRange, _ enclosingRange: NSRange, _ stop: UnsafeMutablePointer?) -> Void in 42 | if enclosingRange.location <= charRange.location { 43 | stop?.pointee = true 44 | } 45 | paraNumber -= 1 46 | }) 47 | lastParaLocation = charRange.location 48 | lastParaNumber = paraNumber 49 | return paraNumber 50 | } else { 51 | // We need to look forward from the last known paragraph for the new paragraph range. This generally happens 52 | // when the text in the UITextView scrolls upwards, revealing paragraphs that follow the ones previously drawn. 53 | let s = textStorage?.string 54 | var paraNumber: Int = lastParaNumber 55 | (s as NSString?)?.enumerateSubstrings(in: NSRange(location: lastParaLocation, length: Int(charRange.location - lastParaLocation)), options: [.byParagraphs, .substringNotRequired], using: {(_ substring: String?, _ substringRange: NSRange, _ enclosingRange: NSRange, _ stop: UnsafeMutablePointer?) -> Void in 56 | if enclosingRange.location >= charRange.location { 57 | stop?.pointee = true 58 | } 59 | paraNumber += 1 60 | }) 61 | lastParaLocation = charRange.location 62 | lastParaNumber = paraNumber 63 | return paraNumber 64 | } 65 | } 66 | 67 | #if os(macOS) 68 | override func processEditing(for textStorage: NSTextStorage, edited editMask: NSTextStorageEditActions, range newCharRange: NSRange, changeInLength delta: Int, invalidatedRange invalidatedCharRange: NSRange) { 69 | super.processEditing(for: textStorage, edited: editMask, range: newCharRange, changeInLength: delta, invalidatedRange: invalidatedCharRange) 70 | if invalidatedCharRange.location < lastParaLocation { 71 | // When the backing store is edited ahead the cached paragraph location, invalidate the cache and force a complete 72 | // recalculation. We cannot be much smarter than this because we don't know how many paragraphs have been deleted 73 | // since the text has already been removed from the backing store. 74 | lastParaLocation = 0 75 | lastParaNumber = 0 76 | } 77 | } 78 | #else 79 | override func processEditing(for textStorage: NSTextStorage, edited editMask: NSTextStorage.EditActions, range newCharRange: NSRange, changeInLength delta: Int, invalidatedRange invalidatedCharRange: NSRange) { 80 | super.processEditing(for: textStorage, edited: editMask, range: newCharRange, changeInLength: delta, invalidatedRange: invalidatedCharRange) 81 | if invalidatedCharRange.location < lastParaLocation { 82 | // When the backing store is edited ahead the cached paragraph location, invalidate the cache and force a complete 83 | // recalculation. We cannot be much smarter than this because we don't know how many paragraphs have been deleted 84 | // since the text has already been removed from the backing store. 85 | lastParaLocation = 0 86 | lastParaNumber = 0 87 | } 88 | } 89 | #endif 90 | 91 | var gutterWidth: CGFloat = 0.0 92 | 93 | override func drawBackground(forGlyphRange glyphsToShow: NSRange, at origin: CGPoint) { 94 | super.drawBackground(forGlyphRange: glyphsToShow, at: origin) 95 | 96 | // Draw line numbers. Note that the background for line number gutter is drawn by the LineNumberTextView class. 97 | 98 | // let style = DefaultTheme().lineNumbersStyle! 99 | 100 | let atts: [NSAttributedString.Key: Any] = [: 101 | // .font: style.font, 102 | // .foregroundColor : style.textColor 103 | ] 104 | 105 | var gutterRect: CGRect = .zero 106 | var paraNumber: Int = 0 107 | 108 | enumerateLineFragments(forGlyphRange: glyphsToShow, using: {(_ rect: CGRect, _ usedRect: CGRect, _ textContainer: NSTextContainer?, _ glyphRange: NSRange, _ stop: UnsafeMutablePointer?) -> Void in 109 | 110 | let charRange: NSRange = self.characterRange(forGlyphRange: glyphRange, actualGlyphRange: nil) 111 | let paraRange: NSRange? = (self.textStorage?.string as NSString?)?.paragraphRange(for: charRange) 112 | 113 | // Only draw line numbers for the paragraph's first line fragment. Subsiquent fragments are wrapped portions of the paragraph and don't get the line number. 114 | if charRange.location == paraRange?.location { 115 | gutterRect = CGRect(x: 0, y: rect.origin.y, width: self.gutterWidth, height: rect.size.height).offsetBy(dx: origin.x, dy: origin.y) 116 | paraNumber = self._paraNumber(for: charRange) 117 | let ln = "\(Int(UInt(paraNumber)) + 1)" 118 | let size: CGSize = ln.size(withAttributes: atts) 119 | ln.draw(in: gutterRect.offsetBy(dx: gutterRect.width - 4 - size.width, dy: 0), withAttributes: atts) 120 | } 121 | }) 122 | 123 | // Deal with the special case of an empty last line where enumerateLineFragmentsForGlyphRange has no line 124 | // fragments to draw. 125 | // if NSMaxRange(glyphsToShow) > numberOfGlyphs { 126 | 127 | if self.textStorage!.string.isEmpty || self.textStorage!.string.hasSuffix("\n") { 128 | 129 | let ln = "\(Int(UInt(paraNumber)) + 2)" 130 | let size: CGSize = ln.size(withAttributes: atts) 131 | gutterRect = gutterRect.offsetBy(dx: 0.0, dy: gutterRect.height) 132 | ln.draw(in: gutterRect.offsetBy(dx: gutterRect.width - 4 - size.width, dy: 0), withAttributes: atts) 133 | 134 | } 135 | 136 | let rect = BezierPath(rect: CGRect(x: 0, y: 0, width: 200, height: 500)) 137 | Color.red.withAlphaComponent(0.5).setFill() 138 | rect.fill() 139 | } 140 | 141 | } 142 | --------------------------------------------------------------------------------