Moved from me2day

This commit is contained in:
ishtar 2014-02-26 18:13:36 +09:00
commit e41c39f09b
45 changed files with 11940 additions and 0 deletions

35
AUTHORS Executable file
View File

@ -0,0 +1,35 @@
Authors ordered by first contribution.
SungMin Ha (ishtar aka iziz, zen.isis@gmail.com)
Hyuk Hur (http://hyukhur.tumblr.com)
Cliff Rowley (cliffrowley@gmail.com)
- Missing return value in formatInOriginalFormat:regionCallingFrom:error
- Compatibility with iOS versions prior to 6.x
Aaron Wojnowski (aaronwojnowski@gmail.com)
- Remove extra r from the countryCodeFromRegionCode method name.
stonyw
- Handle char @ when normalize any strings, eg email
Yosi Taguri (http://ahhhpah.com)
- Failed tests are down to 18 for [ AsYouTypeFormatter ]
Nils Hayat (http://nilsou.com)
- Help to update cocoapods
- Added -[NBPhoneNumberUtil parseWithPhoneCarrierRegion:error:] to parse a number using the phone's carrier country code
Frane Bandov frane (frane@offbyte.com, http://frane.offbyte.com)
- Refactor to reduce memory consumption
(Export NSArray category into separate files,
Optimize constants,
Cache regex patterns to reduce memory and CPU consumption,
Make countyCodeByCarrier method publically available,
Add libPhoneNumber.{h,m} to podspec)
Cliff Ingham (inghamn@bloomington.in.gov, http://bloomington.in.gov/)
- Added explicit type casts to avoid warnings when building for 64 bit iOS...
rhoiberg
- Allow NBPhoneNumberUtil to be created using a specified bundle.

176
LICENSE Executable file
View File

@ -0,0 +1,176 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS

69
README.md Executable file
View File

@ -0,0 +1,69 @@
# libPhoneNumber for iOS
* NBPhoneNumberUtil
* NBAsYouTypeFormatter
### - Install with [CocoaPods](http://cocoapods.org/?q=libPhoneNumber-iOS)
### - Install without CocoaPods
##### Add source files to your projects from libPhoneNumber
- NBPhoneNumberUtil.h, .m
- NBAsYouTypeFormatter.h, .m
- NBNumberFormat.h, .m
- NBPhoneNumber.h, .m
- NBPhoneNumberDesc.h, .m
- NBPhoneNumberDefines.h
- NBPhoneNumberMetadata.h, .m
- NBPhoneNumberMetadataForTesting.h, .m
- Add "NBPhoneNumberMetadata.plist" and "NBPhoneNumberMetadataForTesting.plist" to bundle resources
- Add "CoreTelephony.framework"
See sample test code from "libPhoneNumber-iOS / libPhoneNumberTests / libPhoneNumberTests.m"
### Sample Usage
NBPhoneNumberUtil *phoneUtil = [NBPhoneNumberUtil sharedInstance];
NSError *aError = nil;
NBPhoneNumber *myNumber = [phoneUtil parse:@"6766077303" defaultRegion:@"AT" error:&aError];
if (aError == nil) {
// Should check error
NSLog(@"isValidPhoneNumber ? [%@]", [phoneUtil isValidNumber:myNumber] ? @"YES":@"NO");
NSLog(@"E164 : %@", [phoneUtil format:myNumber numberFormat:NBEPhoneNumberFormatE164
error:&aError]);
NSLog(@"INTERNATIONAL : %@", [phoneUtil format:myNumber numberFormat:NBEPhoneNumberFormatINTERNATIONAL
error:&aError]);
NSLog(@"NATIONAL : %@", [phoneUtil format:myNumber numberFormat:NBEPhoneNumberFormatNATIONAL
error:&aError]);
NSLog(@"RFC3966 : %@", [phoneUtil format:myNumber numberFormat:NBEPhoneNumberFormatRFC3966
error:&aError]);
}
else {
NSLog(@"Error : %@", [aError localizedDescription]);
}
NSLog (@"extractCountryCode [%ld]", [phoneUtil extractCountryCode:@"823213123123"
nationalNumber:nil]);
NSString *res = nil;
UInt32 dRes = [phoneUtil extractCountryCode:@"823213123123" nationalNumber:&res];
NSLog (@"extractCountryCode [%lu] [%@]", dRes, res);
##### Visit [libPhoneNumber](http://code.google.com/p/libphonenumber/) for more information or [mail](zen.isis@gmail.com)
### Metadata managing (updating metadata)
##### Step1. Fetch "metadata.js" and "metadatafortesting.js" from Repositories
svn checkout http://libphonenumber.googlecode.com/svn/trunk/ libphonenumber-read-only
##### Step2. Convert Javascript Object to JSON using PHP scripts
Output - "PhoneNumberMetaData.json" and "PhoneNumberMetaDataForTesting.json"
##### Step3. Generate binary file from NBPhoneMetaDataGenerator
Output - "NBPhoneNumberMetadata.plist" and "NBPhoneNumberMetadataForTesting.plist"
##### Step4. Update exists "NBPhoneNumberMetadata.plist" and "NBPhoneNumberMetadataForTesting.plist" files

19
libPhoneNumber-iOS.podspec Executable file
View File

@ -0,0 +1,19 @@
Pod::Spec.new do |s|
s.name = "libPhoneNumber-iOS"
s.version = "0.61"
s.summary = "iOS library for parsing, formatting, storing and validating international phone numbers from libphonenumber library."
s.description = <<-DESC
libPhoneNumber for iOS
iOS library for parsing, formatting, storing and validating international phone numbers from libphonenumber library.
Visit http://code.google.com/p/libphonenumber/ for more information.
DESC
s.homepage = "https://github.com/me2day/libPhoneNumber-iOS"
s.license = 'Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)'
s.authors = { "iziz" => "zen.isis@gmail.com", "hyukhur" => "hyukhur@gmail.com" }
s.source = { :git => "https://github.com/me2day/libPhoneNumber-iOS.git", :tag => "0.61" }
s.platform = :ios, '4.3'
s.framework = 'CoreTelephony'
s.requires_arc = true
s.source_files = 'libPhoneNumber/NBPhoneNumber.{h,m}', 'libPhoneNumber/NBNumberFormat.{h,m}', 'libPhoneNumber/NBPhoneNumberDesc.{h,m}', 'libPhoneNumber/NBPhoneMetaData.{h,m}', 'libPhoneNumber/NBPhoneNumberUtil.{h,m}', 'libPhoneNumber/NBAsYouTypeFormatter.{h,m}', 'libPhoneNumber/NBPhoneNumberDefines.h', 'libPhoneNumber/NSArray+NBAdditions.{h,m}'
s.resources = "libPhoneNumber/NBPhoneNumberMetadata.plist"
end

View File

@ -0,0 +1,750 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
29F3A15D17B98AE1005D8E07 /* CoreTelephony.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 29F3A15C17B98AE1005D8E07 /* CoreTelephony.framework */; };
29F3A15E17B98B3C005D8E07 /* CoreTelephony.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 29F3A15C17B98AE1005D8E07 /* CoreTelephony.framework */; };
8F04BE90176F062500076CB4 /* NBAsYouTypeFormatterTest.m in Sources */ = {isa = PBXBuildFile; fileRef = FD57B66C16E5B71F000772AF /* NBAsYouTypeFormatterTest.m */; };
8FE047B5174389F300CCA610 /* NBAsYouTypeFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = FD4C786916DB62AC00473849 /* NBAsYouTypeFormatter.m */; };
E1A8557317FE874700A4CDFF /* NSArray+NBAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = E1A8557217FE874700A4CDFF /* NSArray+NBAdditions.m */; };
FD0BD7781679DDA700B19065 /* NBPhoneNumber.m in Sources */ = {isa = PBXBuildFile; fileRef = FD0BD7771679DDA600B19065 /* NBPhoneNumber.m */; };
FD7A0621167715A0004BBEB6 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FD7A0620167715A0004BBEB6 /* UIKit.framework */; };
FD7A0623167715A0004BBEB6 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FD7A0622167715A0004BBEB6 /* Foundation.framework */; };
FD7A0625167715A0004BBEB6 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FD7A0624167715A0004BBEB6 /* CoreGraphics.framework */; };
FD7A062B167715A0004BBEB6 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = FD7A0629167715A0004BBEB6 /* InfoPlist.strings */; };
FD7A062D167715A0004BBEB6 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = FD7A062C167715A0004BBEB6 /* main.m */; };
FD7A0631167715A0004BBEB6 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = FD7A0630167715A0004BBEB6 /* AppDelegate.m */; };
FD7A0633167715A0004BBEB6 /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = FD7A0632167715A0004BBEB6 /* Default.png */; };
FD7A0635167715A0004BBEB6 /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = FD7A0634167715A0004BBEB6 /* Default@2x.png */; };
FD7A0637167715A0004BBEB6 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = FD7A0636167715A0004BBEB6 /* Default-568h@2x.png */; };
FD7A063F167715A1004BBEB6 /* SenTestingKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FD7A063E167715A1004BBEB6 /* SenTestingKit.framework */; };
FD7A0640167715A1004BBEB6 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FD7A0620167715A0004BBEB6 /* UIKit.framework */; };
FD7A0641167715A1004BBEB6 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FD7A0622167715A0004BBEB6 /* Foundation.framework */; };
FD7A0649167715A1004BBEB6 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = FD7A0647167715A1004BBEB6 /* InfoPlist.strings */; };
FD7A064C167715A1004BBEB6 /* NBPhoneNumberUtilTests.m in Sources */ = {isa = PBXBuildFile; fileRef = FD7A064B167715A1004BBEB6 /* NBPhoneNumberUtilTests.m */; };
FD7A0657167715B2004BBEB6 /* NBPhoneNumberUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = FD7A0656167715B2004BBEB6 /* NBPhoneNumberUtil.m */; };
FD7A0658167715B2004BBEB6 /* NBPhoneNumberUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = FD7A0656167715B2004BBEB6 /* NBPhoneNumberUtil.m */; };
FD7A065F167715FD004BBEB6 /* NBNumberFormat.m in Sources */ = {isa = PBXBuildFile; fileRef = FD7A065E167715FD004BBEB6 /* NBNumberFormat.m */; };
FD7A0660167715FD004BBEB6 /* NBNumberFormat.m in Sources */ = {isa = PBXBuildFile; fileRef = FD7A065E167715FD004BBEB6 /* NBNumberFormat.m */; };
FD7A066316771A54004BBEB6 /* NBPhoneNumberDesc.m in Sources */ = {isa = PBXBuildFile; fileRef = FD7A066216771A54004BBEB6 /* NBPhoneNumberDesc.m */; };
FD7A066416771A54004BBEB6 /* NBPhoneNumberDesc.m in Sources */ = {isa = PBXBuildFile; fileRef = FD7A066216771A54004BBEB6 /* NBPhoneNumberDesc.m */; };
FD7A066716771AFD004BBEB6 /* NBPhoneMetaData.m in Sources */ = {isa = PBXBuildFile; fileRef = FD7A066616771AFD004BBEB6 /* NBPhoneMetaData.m */; };
FD7A066816771AFD004BBEB6 /* NBPhoneMetaData.m in Sources */ = {isa = PBXBuildFile; fileRef = FD7A066616771AFD004BBEB6 /* NBPhoneMetaData.m */; };
FD9E3ADC169E5176007E06CC /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FD7A0622167715A0004BBEB6 /* Foundation.framework */; };
FD9E3AE7169E51A2007E06CC /* NBNumberFormat.m in Sources */ = {isa = PBXBuildFile; fileRef = FD7A065E167715FD004BBEB6 /* NBNumberFormat.m */; };
FD9E3AE8169E51A2007E06CC /* NBPhoneMetaData.m in Sources */ = {isa = PBXBuildFile; fileRef = FD7A066616771AFD004BBEB6 /* NBPhoneMetaData.m */; };
FD9E3AE9169E51A2007E06CC /* NBPhoneNumber.m in Sources */ = {isa = PBXBuildFile; fileRef = FD0BD7771679DDA600B19065 /* NBPhoneNumber.m */; };
FD9E3AEA169E51A2007E06CC /* NBPhoneNumberDesc.m in Sources */ = {isa = PBXBuildFile; fileRef = FD7A066216771A54004BBEB6 /* NBPhoneNumberDesc.m */; };
FD9E3AEB169E51A2007E06CC /* NBPhoneNumberUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = FD7A0656167715B2004BBEB6 /* NBPhoneNumberUtil.m */; };
FD9E3AEE169E51D1007E06CC /* NBNumberFormat.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = FD7A065D167715FD004BBEB6 /* NBNumberFormat.h */; };
FD9E3AEF169E51D1007E06CC /* NBPhoneMetaData.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = FD7A066516771AFD004BBEB6 /* NBPhoneMetaData.h */; };
FD9E3AF0169E51D1007E06CC /* NBPhoneNumber.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = FD0BD7761679DDA600B19065 /* NBPhoneNumber.h */; };
FD9E3AF1169E51D1007E06CC /* NBPhoneNumberDefines.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = FDBCAD2016954FE4005E0334 /* NBPhoneNumberDefines.h */; };
FD9E3AF2169E51D1007E06CC /* NBPhoneNumberDesc.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = FD7A066116771A54004BBEB6 /* NBPhoneNumberDesc.h */; };
FD9E3AF3169E51D1007E06CC /* NBPhoneNumberUtil.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = FD7A0655167715B2004BBEB6 /* NBPhoneNumberUtil.h */; };
FD9E3AF6169E62B6007E06CC /* NBPhoneMetaDataGenerator.m in Sources */ = {isa = PBXBuildFile; fileRef = FD7A066E167736BD004BBEB6 /* NBPhoneMetaDataGenerator.m */; };
FDAACB55167F3F11002DB4D4 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FD7A0624167715A0004BBEB6 /* CoreGraphics.framework */; };
FDAE1B3016CE2C1C007EB0ED /* PhoneNumberMetaData.json in Resources */ = {isa = PBXBuildFile; fileRef = FDAE1B2E16CE2C1C007EB0ED /* PhoneNumberMetaData.json */; };
FDAE1B3116CE2C1C007EB0ED /* PhoneNumberMetaData.json in Resources */ = {isa = PBXBuildFile; fileRef = FDAE1B2E16CE2C1C007EB0ED /* PhoneNumberMetaData.json */; };
FDAE1B3216CE2C1C007EB0ED /* PhoneNumberMetaDataForTesting.json in Resources */ = {isa = PBXBuildFile; fileRef = FDAE1B2F16CE2C1C007EB0ED /* PhoneNumberMetaDataForTesting.json */; };
FDAE1B3316CE2C1C007EB0ED /* PhoneNumberMetaDataForTesting.json in Resources */ = {isa = PBXBuildFile; fileRef = FDAE1B2F16CE2C1C007EB0ED /* PhoneNumberMetaDataForTesting.json */; };
FDAE1B3616CE2C92007EB0ED /* NBPhoneNumberMetadata.plist in Resources */ = {isa = PBXBuildFile; fileRef = FDAE1B3416CE2C92007EB0ED /* NBPhoneNumberMetadata.plist */; };
FDAE1B3716CE2C92007EB0ED /* NBPhoneNumberMetadata.plist in Resources */ = {isa = PBXBuildFile; fileRef = FDAE1B3416CE2C92007EB0ED /* NBPhoneNumberMetadata.plist */; };
FDAE1B3816CE2C92007EB0ED /* NBPhoneNumberMetadataForTesting.plist in Resources */ = {isa = PBXBuildFile; fileRef = FDAE1B3516CE2C92007EB0ED /* NBPhoneNumberMetadataForTesting.plist */; };
FDAE1B3916CE2C92007EB0ED /* NBPhoneNumberMetadataForTesting.plist in Resources */ = {isa = PBXBuildFile; fileRef = FDAE1B3516CE2C92007EB0ED /* NBPhoneNumberMetadataForTesting.plist */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
FD7A0642167715A1004BBEB6 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = FD7A0613167715A0004BBEB6 /* Project object */;
proxyType = 1;
remoteGlobalIDString = FD7A061B167715A0004BBEB6;
remoteInfo = libPhoneNumber;
};
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
FD9E3AD9169E5176007E06CC /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "include/${PRODUCT_NAME}";
dstSubfolderSpec = 16;
files = (
FD9E3AEE169E51D1007E06CC /* NBNumberFormat.h in CopyFiles */,
FD9E3AEF169E51D1007E06CC /* NBPhoneMetaData.h in CopyFiles */,
FD9E3AF0169E51D1007E06CC /* NBPhoneNumber.h in CopyFiles */,
FD9E3AF1169E51D1007E06CC /* NBPhoneNumberDefines.h in CopyFiles */,
FD9E3AF2169E51D1007E06CC /* NBPhoneNumberDesc.h in CopyFiles */,
FD9E3AF3169E51D1007E06CC /* NBPhoneNumberUtil.h in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
29F3A15C17B98AE1005D8E07 /* CoreTelephony.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreTelephony.framework; path = System/Library/Frameworks/CoreTelephony.framework; sourceTree = SDKROOT; };
4D43EF831740825100C24FF3 /* libPhoneNumber-iOS.podspec */ = {isa = PBXFileReference; lastKnownFileType = text; path = "libPhoneNumber-iOS.podspec"; sourceTree = SOURCE_ROOT; };
E1A8557117FE874700A4CDFF /* NSArray+NBAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSArray+NBAdditions.h"; sourceTree = "<group>"; };
E1A8557217FE874700A4CDFF /* NSArray+NBAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSArray+NBAdditions.m"; sourceTree = "<group>"; };
FD0BD7761679DDA600B19065 /* NBPhoneNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NBPhoneNumber.h; sourceTree = "<group>"; };
FD0BD7771679DDA600B19065 /* NBPhoneNumber.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NBPhoneNumber.m; sourceTree = "<group>"; };
FD2014DC169A8A82003491D9 /* index.php */ = {isa = PBXFileReference; lastKnownFileType = text.script.php; path = index.php; sourceTree = "<group>"; };
FD2014DD169A8A82003491D9 /* libPhoneNumberGenerator.php */ = {isa = PBXFileReference; lastKnownFileType = text.script.php; path = libPhoneNumberGenerator.php; sourceTree = "<group>"; };
FD4C786816DB62AC00473849 /* NBAsYouTypeFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NBAsYouTypeFormatter.h; sourceTree = "<group>"; };
FD4C786916DB62AC00473849 /* NBAsYouTypeFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NBAsYouTypeFormatter.m; sourceTree = "<group>"; };
FD57B66B16E5B71F000772AF /* NBAsYouTypeFormatterTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NBAsYouTypeFormatterTest.h; sourceTree = "<group>"; };
FD57B66C16E5B71F000772AF /* NBAsYouTypeFormatterTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NBAsYouTypeFormatterTest.m; sourceTree = "<group>"; };
FD7A061C167715A0004BBEB6 /* libPhoneNumber.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = libPhoneNumber.app; sourceTree = BUILT_PRODUCTS_DIR; };
FD7A0620167715A0004BBEB6 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
FD7A0622167715A0004BBEB6 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
FD7A0624167715A0004BBEB6 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
FD7A0628167715A0004BBEB6 /* libPhoneNumber-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "libPhoneNumber-Info.plist"; sourceTree = "<group>"; };
FD7A062A167715A0004BBEB6 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
FD7A062C167715A0004BBEB6 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
FD7A062E167715A0004BBEB6 /* libPhoneNumber-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "libPhoneNumber-Prefix.pch"; sourceTree = "<group>"; };
FD7A062F167715A0004BBEB6 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
FD7A0630167715A0004BBEB6 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
FD7A0632167715A0004BBEB6 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = "<group>"; };
FD7A0634167715A0004BBEB6 /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x.png"; sourceTree = "<group>"; };
FD7A0636167715A0004BBEB6 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = "<group>"; };
FD7A063D167715A1004BBEB6 /* libPhoneNumberTests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = libPhoneNumberTests.octest; sourceTree = BUILT_PRODUCTS_DIR; };
FD7A063E167715A1004BBEB6 /* SenTestingKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SenTestingKit.framework; path = Library/Frameworks/SenTestingKit.framework; sourceTree = DEVELOPER_DIR; };
FD7A0646167715A1004BBEB6 /* libPhoneNumberTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "libPhoneNumberTests-Info.plist"; sourceTree = "<group>"; };
FD7A0648167715A1004BBEB6 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
FD7A064A167715A1004BBEB6 /* NBPhoneNumberUtilTests.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NBPhoneNumberUtilTests.h; sourceTree = "<group>"; };
FD7A064B167715A1004BBEB6 /* NBPhoneNumberUtilTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NBPhoneNumberUtilTests.m; sourceTree = "<group>"; };
FD7A0655167715B2004BBEB6 /* NBPhoneNumberUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NBPhoneNumberUtil.h; sourceTree = "<group>"; };
FD7A0656167715B2004BBEB6 /* NBPhoneNumberUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NBPhoneNumberUtil.m; sourceTree = "<group>"; };
FD7A065D167715FD004BBEB6 /* NBNumberFormat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NBNumberFormat.h; sourceTree = "<group>"; };
FD7A065E167715FD004BBEB6 /* NBNumberFormat.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NBNumberFormat.m; sourceTree = "<group>"; };
FD7A066116771A54004BBEB6 /* NBPhoneNumberDesc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NBPhoneNumberDesc.h; sourceTree = "<group>"; };
FD7A066216771A54004BBEB6 /* NBPhoneNumberDesc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NBPhoneNumberDesc.m; sourceTree = "<group>"; };
FD7A066516771AFD004BBEB6 /* NBPhoneMetaData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NBPhoneMetaData.h; sourceTree = "<group>"; };
FD7A066616771AFD004BBEB6 /* NBPhoneMetaData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NBPhoneMetaData.m; sourceTree = "<group>"; };
FD7A066D167736BD004BBEB6 /* NBPhoneMetaDataGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NBPhoneMetaDataGenerator.h; sourceTree = "<group>"; };
FD7A066E167736BD004BBEB6 /* NBPhoneMetaDataGenerator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NBPhoneMetaDataGenerator.m; sourceTree = "<group>"; };
FD9E3ADB169E5176007E06CC /* liblibPhoneNumberiOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = liblibPhoneNumberiOS.a; sourceTree = BUILT_PRODUCTS_DIR; };
FD9E3ADF169E5176007E06CC /* libPhoneNumberiOS-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "libPhoneNumberiOS-Prefix.pch"; sourceTree = "<group>"; };
FDAE1B2E16CE2C1C007EB0ED /* PhoneNumberMetaData.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = PhoneNumberMetaData.json; sourceTree = "<group>"; };
FDAE1B2F16CE2C1C007EB0ED /* PhoneNumberMetaDataForTesting.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = PhoneNumberMetaDataForTesting.json; sourceTree = "<group>"; };
FDAE1B3416CE2C92007EB0ED /* NBPhoneNumberMetadata.plist */ = {isa = PBXFileReference; lastKnownFileType = file.bplist; path = NBPhoneNumberMetadata.plist; sourceTree = "<group>"; };
FDAE1B3516CE2C92007EB0ED /* NBPhoneNumberMetadataForTesting.plist */ = {isa = PBXFileReference; lastKnownFileType = file.bplist; path = NBPhoneNumberMetadataForTesting.plist; sourceTree = "<group>"; };
FDBCAD2016954FE4005E0334 /* NBPhoneNumberDefines.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NBPhoneNumberDefines.h; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
FD7A0619167715A0004BBEB6 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
29F3A15D17B98AE1005D8E07 /* CoreTelephony.framework in Frameworks */,
FD7A0621167715A0004BBEB6 /* UIKit.framework in Frameworks */,
FD7A0623167715A0004BBEB6 /* Foundation.framework in Frameworks */,
FD7A0625167715A0004BBEB6 /* CoreGraphics.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
FD7A0639167715A1004BBEB6 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
FDAACB55167F3F11002DB4D4 /* CoreGraphics.framework in Frameworks */,
FD7A063F167715A1004BBEB6 /* SenTestingKit.framework in Frameworks */,
FD7A0640167715A1004BBEB6 /* UIKit.framework in Frameworks */,
FD7A0641167715A1004BBEB6 /* Foundation.framework in Frameworks */,
29F3A15E17B98B3C005D8E07 /* CoreTelephony.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
FD9E3AD8169E5176007E06CC /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
FD9E3ADC169E5176007E06CC /* Foundation.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
FD0F11AD169AC2AB008DF508 /* Classes */ = {
isa = PBXGroup;
children = (
FD4C786816DB62AC00473849 /* NBAsYouTypeFormatter.h */,
FD4C786916DB62AC00473849 /* NBAsYouTypeFormatter.m */,
FD7A065D167715FD004BBEB6 /* NBNumberFormat.h */,
FD7A065E167715FD004BBEB6 /* NBNumberFormat.m */,
FD7A066516771AFD004BBEB6 /* NBPhoneMetaData.h */,
FD7A066616771AFD004BBEB6 /* NBPhoneMetaData.m */,
FD0BD7761679DDA600B19065 /* NBPhoneNumber.h */,
FD0BD7771679DDA600B19065 /* NBPhoneNumber.m */,
FDBCAD2016954FE4005E0334 /* NBPhoneNumberDefines.h */,
E1A8557117FE874700A4CDFF /* NSArray+NBAdditions.h */,
E1A8557217FE874700A4CDFF /* NSArray+NBAdditions.m */,
FD7A066116771A54004BBEB6 /* NBPhoneNumberDesc.h */,
FD7A066216771A54004BBEB6 /* NBPhoneNumberDesc.m */,
FD7A0655167715B2004BBEB6 /* NBPhoneNumberUtil.h */,
FD7A0656167715B2004BBEB6 /* NBPhoneNumberUtil.m */,
);
name = Classes;
sourceTree = "<group>";
};
FD2014DF169A8A88003491D9 /* Javascript Object to JSON Converter (PHP) */ = {
isa = PBXGroup;
children = (
FD2014DC169A8A82003491D9 /* index.php */,
FD2014DD169A8A82003491D9 /* libPhoneNumberGenerator.php */,
);
name = "Javascript Object to JSON Converter (PHP)";
path = libPhoneNumberTests;
sourceTree = SOURCE_ROOT;
};
FD7A0611167715A0004BBEB6 = {
isa = PBXGroup;
children = (
FD7A0626167715A0004BBEB6 /* libPhoneNumber */,
FD7A0644167715A1004BBEB6 /* libPhoneNumber UnitTest */,
FD9E3ADD169E5176007E06CC /* libPhoneNumberiOS */,
FD7A061F167715A0004BBEB6 /* Frameworks */,
FD7A061D167715A0004BBEB6 /* Products */,
);
sourceTree = "<group>";
};
FD7A061D167715A0004BBEB6 /* Products */ = {
isa = PBXGroup;
children = (
FD7A061C167715A0004BBEB6 /* libPhoneNumber.app */,
FD7A063D167715A1004BBEB6 /* libPhoneNumberTests.octest */,
FD9E3ADB169E5176007E06CC /* liblibPhoneNumberiOS.a */,
);
name = Products;
sourceTree = "<group>";
};
FD7A061F167715A0004BBEB6 /* Frameworks */ = {
isa = PBXGroup;
children = (
FD7A0624167715A0004BBEB6 /* CoreGraphics.framework */,
FD7A0622167715A0004BBEB6 /* Foundation.framework */,
FD7A063E167715A1004BBEB6 /* SenTestingKit.framework */,
FD7A0620167715A0004BBEB6 /* UIKit.framework */,
29F3A15C17B98AE1005D8E07 /* CoreTelephony.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
FD7A0626167715A0004BBEB6 /* libPhoneNumber */ = {
isa = PBXGroup;
children = (
4D43EF831740825100C24FF3 /* libPhoneNumber-iOS.podspec */,
FD7A062F167715A0004BBEB6 /* AppDelegate.h */,
FD7A0630167715A0004BBEB6 /* AppDelegate.m */,
FD0F11AD169AC2AB008DF508 /* Classes */,
FDB5E108169BE40C00AB88AE /* Metadata */,
FD7A0627167715A0004BBEB6 /* Supporting Files */,
);
path = libPhoneNumber;
sourceTree = "<group>";
};
FD7A0627167715A0004BBEB6 /* Supporting Files */ = {
isa = PBXGroup;
children = (
FD2014DF169A8A88003491D9 /* Javascript Object to JSON Converter (PHP) */,
FD7A066D167736BD004BBEB6 /* NBPhoneMetaDataGenerator.h */,
FD7A066E167736BD004BBEB6 /* NBPhoneMetaDataGenerator.m */,
FD7A062C167715A0004BBEB6 /* main.m */,
FD7A062E167715A0004BBEB6 /* libPhoneNumber-Prefix.pch */,
FD7A0628167715A0004BBEB6 /* libPhoneNumber-Info.plist */,
FD7A0636167715A0004BBEB6 /* Default-568h@2x.png */,
FD7A0632167715A0004BBEB6 /* Default.png */,
FD7A0634167715A0004BBEB6 /* Default@2x.png */,
FD7A0629167715A0004BBEB6 /* InfoPlist.strings */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
FD7A0644167715A1004BBEB6 /* libPhoneNumber UnitTest */ = {
isa = PBXGroup;
children = (
FD7A064A167715A1004BBEB6 /* NBPhoneNumberUtilTests.h */,
FD7A064B167715A1004BBEB6 /* NBPhoneNumberUtilTests.m */,
FD57B66B16E5B71F000772AF /* NBAsYouTypeFormatterTest.h */,
FD57B66C16E5B71F000772AF /* NBAsYouTypeFormatterTest.m */,
FD7A0645167715A1004BBEB6 /* Supporting Files */,
);
name = "libPhoneNumber UnitTest";
path = libPhoneNumberTests;
sourceTree = SOURCE_ROOT;
};
FD7A0645167715A1004BBEB6 /* Supporting Files */ = {
isa = PBXGroup;
children = (
FD7A0647167715A1004BBEB6 /* InfoPlist.strings */,
FD7A0646167715A1004BBEB6 /* libPhoneNumberTests-Info.plist */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
FD9E3ADD169E5176007E06CC /* libPhoneNumberiOS */ = {
isa = PBXGroup;
children = (
FD9E3ADE169E5176007E06CC /* Supporting Files */,
);
path = libPhoneNumberiOS;
sourceTree = "<group>";
};
FD9E3ADE169E5176007E06CC /* Supporting Files */ = {
isa = PBXGroup;
children = (
FD9E3ADF169E5176007E06CC /* libPhoneNumberiOS-Prefix.pch */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
FDB5E108169BE40C00AB88AE /* Metadata */ = {
isa = PBXGroup;
children = (
FDAE1B2E16CE2C1C007EB0ED /* PhoneNumberMetaData.json */,
FDAE1B2F16CE2C1C007EB0ED /* PhoneNumberMetaDataForTesting.json */,
FDAE1B3416CE2C92007EB0ED /* NBPhoneNumberMetadata.plist */,
FDAE1B3516CE2C92007EB0ED /* NBPhoneNumberMetadataForTesting.plist */,
);
name = Metadata;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
FD7A061B167715A0004BBEB6 /* libPhoneNumber */ = {
isa = PBXNativeTarget;
buildConfigurationList = FD7A064F167715A1004BBEB6 /* Build configuration list for PBXNativeTarget "libPhoneNumber" */;
buildPhases = (
FD7A0618167715A0004BBEB6 /* Sources */,
FD7A0619167715A0004BBEB6 /* Frameworks */,
FD7A061A167715A0004BBEB6 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = libPhoneNumber;
productName = libPhoneNumber;
productReference = FD7A061C167715A0004BBEB6 /* libPhoneNumber.app */;
productType = "com.apple.product-type.application";
};
FD7A063C167715A1004BBEB6 /* libPhoneNumberTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = FD7A0652167715A1004BBEB6 /* Build configuration list for PBXNativeTarget "libPhoneNumberTests" */;
buildPhases = (
FD7A0638167715A1004BBEB6 /* Sources */,
FD7A0639167715A1004BBEB6 /* Frameworks */,
FD7A063A167715A1004BBEB6 /* Resources */,
FD7A063B167715A1004BBEB6 /* ShellScript */,
);
buildRules = (
);
dependencies = (
FD7A0643167715A1004BBEB6 /* PBXTargetDependency */,
);
name = libPhoneNumberTests;
productName = libPhoneNumberTests;
productReference = FD7A063D167715A1004BBEB6 /* libPhoneNumberTests.octest */;
productType = "com.apple.product-type.bundle";
};
FD9E3ADA169E5176007E06CC /* libPhoneNumberiOS */ = {
isa = PBXNativeTarget;
buildConfigurationList = FD9E3AE4169E5176007E06CC /* Build configuration list for PBXNativeTarget "libPhoneNumberiOS" */;
buildPhases = (
FD9E3AD7169E5176007E06CC /* Sources */,
FD9E3AD8169E5176007E06CC /* Frameworks */,
FD9E3AD9169E5176007E06CC /* CopyFiles */,
);
buildRules = (
);
dependencies = (
);
name = libPhoneNumberiOS;
productName = libPhoneNumberiOS;
productReference = FD9E3ADB169E5176007E06CC /* liblibPhoneNumberiOS.a */;
productType = "com.apple.product-type.library.static";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
FD7A0613167715A0004BBEB6 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0450;
ORGANIZATIONNAME = NHN;
};
buildConfigurationList = FD7A0616167715A0004BBEB6 /* Build configuration list for PBXProject "libPhoneNumber" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = FD7A0611167715A0004BBEB6;
productRefGroup = FD7A061D167715A0004BBEB6 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
FD7A061B167715A0004BBEB6 /* libPhoneNumber */,
FD7A063C167715A1004BBEB6 /* libPhoneNumberTests */,
FD9E3ADA169E5176007E06CC /* libPhoneNumberiOS */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
FD7A061A167715A0004BBEB6 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
FD7A062B167715A0004BBEB6 /* InfoPlist.strings in Resources */,
FD7A0633167715A0004BBEB6 /* Default.png in Resources */,
FD7A0635167715A0004BBEB6 /* Default@2x.png in Resources */,
FD7A0637167715A0004BBEB6 /* Default-568h@2x.png in Resources */,
FDAE1B3016CE2C1C007EB0ED /* PhoneNumberMetaData.json in Resources */,
FDAE1B3216CE2C1C007EB0ED /* PhoneNumberMetaDataForTesting.json in Resources */,
FDAE1B3616CE2C92007EB0ED /* NBPhoneNumberMetadata.plist in Resources */,
FDAE1B3816CE2C92007EB0ED /* NBPhoneNumberMetadataForTesting.plist in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
FD7A063A167715A1004BBEB6 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
FD7A0649167715A1004BBEB6 /* InfoPlist.strings in Resources */,
FDAE1B3116CE2C1C007EB0ED /* PhoneNumberMetaData.json in Resources */,
FDAE1B3316CE2C1C007EB0ED /* PhoneNumberMetaDataForTesting.json in Resources */,
FDAE1B3716CE2C92007EB0ED /* NBPhoneNumberMetadata.plist in Resources */,
FDAE1B3916CE2C92007EB0ED /* NBPhoneNumberMetadataForTesting.plist in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
FD7A063B167715A1004BBEB6 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "# Run the unit tests in this test bundle.\n\"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests\"\n";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
FD7A0618167715A0004BBEB6 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
FD9E3AF6169E62B6007E06CC /* NBPhoneMetaDataGenerator.m in Sources */,
E1A8557317FE874700A4CDFF /* NSArray+NBAdditions.m in Sources */,
FD7A062D167715A0004BBEB6 /* main.m in Sources */,
FD7A0631167715A0004BBEB6 /* AppDelegate.m in Sources */,
FD7A0657167715B2004BBEB6 /* NBPhoneNumberUtil.m in Sources */,
FD7A065F167715FD004BBEB6 /* NBNumberFormat.m in Sources */,
FD7A066316771A54004BBEB6 /* NBPhoneNumberDesc.m in Sources */,
FD7A066716771AFD004BBEB6 /* NBPhoneMetaData.m in Sources */,
FD0BD7781679DDA700B19065 /* NBPhoneNumber.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
FD7A0638167715A1004BBEB6 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
8F04BE90176F062500076CB4 /* NBAsYouTypeFormatterTest.m in Sources */,
8FE047B5174389F300CCA610 /* NBAsYouTypeFormatter.m in Sources */,
FD7A064C167715A1004BBEB6 /* NBPhoneNumberUtilTests.m in Sources */,
FD7A0658167715B2004BBEB6 /* NBPhoneNumberUtil.m in Sources */,
FD7A0660167715FD004BBEB6 /* NBNumberFormat.m in Sources */,
FD7A066416771A54004BBEB6 /* NBPhoneNumberDesc.m in Sources */,
FD7A066816771AFD004BBEB6 /* NBPhoneMetaData.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
FD9E3AD7169E5176007E06CC /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
FD9E3AE7169E51A2007E06CC /* NBNumberFormat.m in Sources */,
FD9E3AE8169E51A2007E06CC /* NBPhoneMetaData.m in Sources */,
FD9E3AE9169E51A2007E06CC /* NBPhoneNumber.m in Sources */,
FD9E3AEA169E51A2007E06CC /* NBPhoneNumberDesc.m in Sources */,
FD9E3AEB169E51A2007E06CC /* NBPhoneNumberUtil.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
FD7A0643167715A1004BBEB6 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = FD7A061B167715A0004BBEB6 /* libPhoneNumber */;
targetProxy = FD7A0642167715A1004BBEB6 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
FD7A0629167715A0004BBEB6 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
FD7A062A167715A0004BBEB6 /* en */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
FD7A0647167715A1004BBEB6 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
FD7A0648167715A1004BBEB6 /* en */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
FD7A064D167715A1004BBEB6 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "$(SDKROOT)/usr/include/libxml2";
IPHONEOS_DEPLOYMENT_TARGET = 4.3;
ONLY_ACTIVE_ARCH = YES;
OTHER_CFLAGS = "-lxml2";
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
FD7A064E167715A1004BBEB6 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "$(SDKROOT)/usr/include/libxml2";
IPHONEOS_DEPLOYMENT_TARGET = 4.3;
OTHER_CFLAGS = "-lxml2";
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
FD7A0650167715A1004BBEB6 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DOCUMENTATION_COMMENTS = NO;
CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = NO;
CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = NO;
CLANG_WARN_OBJC_RECEIVER_WEAK = YES;
CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES;
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "libPhoneNumber/libPhoneNumber-Prefix.pch";
GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES;
GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES;
GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES;
GCC_WARN_SHADOW = YES;
GCC_WARN_STRICT_SELECTOR_MATCH = NO;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_LABEL = YES;
GCC_WARN_UNUSED_PARAMETER = NO;
HEADER_SEARCH_PATHS = "";
INFOPLIST_FILE = "libPhoneNumber/libPhoneNumber-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 4.3;
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
name = Debug;
};
FD7A0651167715A1004BBEB6 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DOCUMENTATION_COMMENTS = NO;
CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = NO;
CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = NO;
CLANG_WARN_OBJC_RECEIVER_WEAK = YES;
CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES;
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "libPhoneNumber/libPhoneNumber-Prefix.pch";
GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES;
GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES;
GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES;
GCC_WARN_SHADOW = YES;
GCC_WARN_STRICT_SELECTOR_MATCH = NO;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_LABEL = YES;
GCC_WARN_UNUSED_PARAMETER = NO;
HEADER_SEARCH_PATHS = "";
INFOPLIST_FILE = "libPhoneNumber/libPhoneNumber-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 4.3;
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
name = Release;
};
FD7A0653167715A1004BBEB6 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/libPhoneNumber.app/libPhoneNumber";
FRAMEWORK_SEARCH_PATHS = (
"\"$(SDKROOT)/Developer/Library/Frameworks\"",
"\"$(DEVELOPER_LIBRARY_DIR)/Frameworks\"",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "libPhoneNumber/libPhoneNumber-Prefix.pch";
HEADER_SEARCH_PATHS = "";
INFOPLIST_FILE = "libPhoneNumberTests/libPhoneNumberTests-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUNDLE_LOADER)";
WRAPPER_EXTENSION = octest;
};
name = Debug;
};
FD7A0654167715A1004BBEB6 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/libPhoneNumber.app/libPhoneNumber";
FRAMEWORK_SEARCH_PATHS = (
"\"$(SDKROOT)/Developer/Library/Frameworks\"",
"\"$(DEVELOPER_LIBRARY_DIR)/Frameworks\"",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "libPhoneNumber/libPhoneNumber-Prefix.pch";
HEADER_SEARCH_PATHS = "";
INFOPLIST_FILE = "libPhoneNumberTests/libPhoneNumberTests-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUNDLE_LOADER)";
WRAPPER_EXTENSION = octest;
};
name = Release;
};
FD9E3AE5169E5176007E06CC /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
DSTROOT = /tmp/libPhoneNumberiOS.dst;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "libPhoneNumberiOS/libPhoneNumberiOS-Prefix.pch";
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
};
name = Debug;
};
FD9E3AE6169E5176007E06CC /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
DSTROOT = /tmp/libPhoneNumberiOS.dst;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "libPhoneNumberiOS/libPhoneNumberiOS-Prefix.pch";
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
FD7A0616167715A0004BBEB6 /* Build configuration list for PBXProject "libPhoneNumber" */ = {
isa = XCConfigurationList;
buildConfigurations = (
FD7A064D167715A1004BBEB6 /* Debug */,
FD7A064E167715A1004BBEB6 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
FD7A064F167715A1004BBEB6 /* Build configuration list for PBXNativeTarget "libPhoneNumber" */ = {
isa = XCConfigurationList;
buildConfigurations = (
FD7A0650167715A1004BBEB6 /* Debug */,
FD7A0651167715A1004BBEB6 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
FD7A0652167715A1004BBEB6 /* Build configuration list for PBXNativeTarget "libPhoneNumberTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
FD7A0653167715A1004BBEB6 /* Debug */,
FD7A0654167715A1004BBEB6 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
FD9E3AE4169E5176007E06CC /* Build configuration list for PBXNativeTarget "libPhoneNumberiOS" */ = {
isa = XCConfigurationList;
buildConfigurations = (
FD9E3AE5169E5176007E06CC /* Debug */,
FD9E3AE6169E5176007E06CC /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = FD7A0613167715A0004BBEB6 /* Project object */;
}

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:libPhoneNumber.xcodeproj">
</FileRef>
</Workspace>

14
libPhoneNumber/AppDelegate.h Executable file
View File

@ -0,0 +1,14 @@
//
// AppDelegate.h
// libPhoneNumber
//
// Created by NHN Corp. Last Edited by BAND dev team (band_dev@nhn.com)
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end

54
libPhoneNumber/AppDelegate.m Executable file
View File

@ -0,0 +1,54 @@
//
// AppDelegate.m
// libPhoneNumber
//
// Created by NHN Corp. Last Edited by BAND dev team (band_dev@nhn.com)
//
#import "AppDelegate.h"
#import "NBPhoneMetaDataGenerator.h"
#import "NBPhoneNumberUtil.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.backgroundColor = [UIColor blackColor];
[self.window makeKeyAndVisible];
NBPhoneMetaDataGenerator *generator = [[NBPhoneMetaDataGenerator alloc] init];
[generator generateMetadataClasses];
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application
{
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
- (void)applicationDidEnterBackground:(UIApplication *)application
{
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
- (void)applicationWillEnterForeground:(UIApplication *)application
{
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}
- (void)applicationDidBecomeActive:(UIApplication *)application
{
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
- (void)applicationWillTerminate:(UIApplication *)application
{
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
@end

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
libPhoneNumber/Default.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

BIN
libPhoneNumber/Default@2x.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -0,0 +1,27 @@
//
// NBAsYouTypeFormatter.h
// libPhoneNumber
//
// Created by ishtar on 13. 2. 25..
// Copyright (c) 2013년 NHN. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NBAsYouTypeFormatter : NSObject
- (id)initWithRegionCode:(NSString*)regionCode;
- (id)initWithRegionCodeForTest:(NSString*)regionCode;
- (id)initWithRegionCode:(NSString*)regionCode bundle:(NSBundle *)bundle;
- (id)initWithRegionCodeForTest:(NSString*)regionCode bundle:(NSBundle *)bundle;
- (NSString*)inputDigit:(NSString*)nextChar;
- (NSString*)inputDigitAndRememberPosition:(NSString*)nextChar;
- (NSString*)removeLastDigit;
- (NSString*)removeLastDigitAndRememberPosition;
- (int)getRememberedPosition;
- (void)clear;
@end

File diff suppressed because it is too large Load Diff

22
libPhoneNumber/NBNumberFormat.h Executable file
View File

@ -0,0 +1,22 @@
//
// NBPhoneNumberFormat.h
// libPhoneNumber
//
// Created by NHN Corp. Last Edited by BAND dev team (band_dev@nhn.com)
//
#import <Foundation/Foundation.h>
@interface NBNumberFormat : NSObject
// from phonemetadata.pb.js
/* 1 */ @property (nonatomic, strong, readwrite) NSString *pattern;
/* 2 */ @property (nonatomic, strong, readwrite) NSString *format;
/* 3 */ @property (nonatomic, strong, readwrite) NSMutableArray *leadingDigitsPatterns;
/* 4 */ @property (nonatomic, strong, readwrite) NSString *nationalPrefixFormattingRule;
/* 6 */ @property (nonatomic, assign, readwrite) BOOL nationalPrefixOptionalWhenFormatting;
/* 5 */ @property (nonatomic, strong, readwrite) NSString *domesticCarrierCodeFormattingRule;
- (id)initWithData:(id)data;
@end

139
libPhoneNumber/NBNumberFormat.m Executable file
View File

@ -0,0 +1,139 @@
//
// NBPhoneNumberFormat.m
// libPhoneNumber
//
// Created by NHN Corp. Last Edited by BAND dev team (band_dev@nhn.com)
//
#import "NBNumberFormat.h"
#import "NSArray+NBAdditions.h"
@implementation NBNumberFormat
@synthesize pattern, format, leadingDigitsPatterns, nationalPrefixFormattingRule, nationalPrefixOptionalWhenFormatting, domesticCarrierCodeFormattingRule;
- (id)initWithData:(id)data
{
self = [self init];
if (self && data != nil && [data isKindOfClass:[NSArray class]])
{
/* 1 */ self.pattern = [data safeObjectAtIndex:1];
/* 2 */ self.format = [data safeObjectAtIndex:2];
/* 3 */ self.leadingDigitsPatterns = [self stringArrayFromData:[data safeObjectAtIndex:3]]; // NSString array
/* 4 */ self.nationalPrefixFormattingRule = [data safeObjectAtIndex:4];
/* 6 */ self.nationalPrefixOptionalWhenFormatting = [[data safeObjectAtIndex:6] boolValue];
/* 5 */ self.domesticCarrierCodeFormattingRule = [data safeObjectAtIndex:5];
}
return self;
}
- (id)init
{
self = [super init];
if (self)
{
self.nationalPrefixOptionalWhenFormatting = NO;
self.leadingDigitsPatterns = [[NSMutableArray alloc] init];
}
return self;
}
- (NSMutableArray*)stringArrayFromData:(id)data
{
NSMutableArray *resArray = [[NSMutableArray alloc] init];
if (data != nil && [data isKindOfClass:[NSArray class]])
{
for (id numFormat in data)
{
if ([numFormat isKindOfClass:[NSString class]])
{
[resArray addObject:numFormat];
}
else
{
[resArray addObject:[numFormat stringValue]];
}
}
}
return resArray;
}
- (NSString *)description
{
return [NSString stringWithFormat:@"[pattern:%@, format:%@, leadingDigitsPattern:%@, nationalPrefixFormattingRule:%@, nationalPrefixOptionalWhenFormatting:%@, domesticCarrierCodeFormattingRule:%@]",
self.pattern, self.format, self.leadingDigitsPatterns, self.nationalPrefixFormattingRule, self.nationalPrefixOptionalWhenFormatting?@"Y":@"N", self.domesticCarrierCodeFormattingRule];
}
- (id)copyWithZone:(NSZone *)zone
{
NBNumberFormat *phoneFormatCopy = [[NBNumberFormat allocWithZone:zone] init];
/*
1 @property (nonatomic, strong, readwrite) NSString *pattern;
2 @property (nonatomic, strong, readwrite) NSString *format;
3 @property (nonatomic, strong, readwrite) NSString *leadingDigitsPattern;
4 @property (nonatomic, strong, readwrite) NSString *nationalPrefixFormattingRule;
6 @property (nonatomic, assign, readwrite) BOOL nationalPrefixOptionalWhenFormatting;
5 @property (nonatomic, strong, readwrite) NSString *domesticCarrierCodeFormattingRule;
*/
phoneFormatCopy.pattern = [self.pattern copy];
phoneFormatCopy.format = [self.format copy];
phoneFormatCopy.leadingDigitsPatterns = [self.leadingDigitsPatterns copy];
phoneFormatCopy.nationalPrefixFormattingRule = [self.nationalPrefixFormattingRule copy];
phoneFormatCopy.nationalPrefixOptionalWhenFormatting = self.nationalPrefixOptionalWhenFormatting;
phoneFormatCopy.domesticCarrierCodeFormattingRule = [self.domesticCarrierCodeFormattingRule copy];
return phoneFormatCopy;
}
- (id)initWithCoder:(NSCoder*)coder
{
if (self = [super init])
{
self.pattern = [coder decodeObjectForKey:@"pattern"];
self.format = [coder decodeObjectForKey:@"format"];
self.leadingDigitsPatterns = [coder decodeObjectForKey:@"leadingDigitsPatterns"];
self.nationalPrefixFormattingRule = [coder decodeObjectForKey:@"nationalPrefixFormattingRule"];
self.nationalPrefixOptionalWhenFormatting = [[coder decodeObjectForKey:@"nationalPrefixOptionalWhenFormatting"] boolValue];
self.domesticCarrierCodeFormattingRule = [coder decodeObjectForKey:@"domesticCarrierCodeFormattingRule"];
}
return self;
}
- (void)encodeWithCoder:(NSCoder*)coder
{
[coder encodeObject:self.pattern forKey:@"pattern"];
[coder encodeObject:self.format forKey:@"format"];
[coder encodeObject:self.leadingDigitsPatterns forKey:@"leadingDigitsPatterns"];
[coder encodeObject:self.nationalPrefixFormattingRule forKey:@"nationalPrefixFormattingRule"];
[coder encodeObject:[NSNumber numberWithBool:self.nationalPrefixOptionalWhenFormatting] forKey:@"nationalPrefixOptionalWhenFormatting"];
[coder encodeObject:self.domesticCarrierCodeFormattingRule forKey:@"domesticCarrierCodeFormattingRule"];
}
- (void)setData:(id)data
{
if ([data isKindOfClass:[NSArray class]] || [data isKindOfClass:[NSMutableArray class]])
{
}
else if ([data isKindOfClass:[NSDictionary class]] || [data isKindOfClass:[NSMutableDictionary class]])
{
}
}
@end

View File

@ -0,0 +1,45 @@
//
// M2PhoneMetaData.h
// libPhoneNumber
//
// Created by NHN Corp. Last Edited by BAND dev team (band_dev@nhn.com)
//
#import <Foundation/Foundation.h>
@class NBPhoneNumberDesc, NBNumberFormat;
@interface NBPhoneMetaData : NSObject
// from phonemetadata.pb.js
/* 1 */ @property (nonatomic, strong, readwrite) NBPhoneNumberDesc *generalDesc;
/* 2 */ @property (nonatomic, strong, readwrite) NBPhoneNumberDesc *fixedLine;
/* 3 */ @property (nonatomic, strong, readwrite) NBPhoneNumberDesc *mobile;
/* 4 */ @property (nonatomic, strong, readwrite) NBPhoneNumberDesc *tollFree;
/* 5 */ @property (nonatomic, strong, readwrite) NBPhoneNumberDesc *premiumRate;
/* 6 */ @property (nonatomic, strong, readwrite) NBPhoneNumberDesc *sharedCost;
/* 7 */ @property (nonatomic, strong, readwrite) NBPhoneNumberDesc *personalNumber;
/* 8 */ @property (nonatomic, strong, readwrite) NBPhoneNumberDesc *voip;
/* 21 */ @property (nonatomic, strong, readwrite) NBPhoneNumberDesc *pager;
/* 25 */ @property (nonatomic, strong, readwrite) NBPhoneNumberDesc *uan;
/* 27 */ @property (nonatomic, strong, readwrite) NBPhoneNumberDesc *emergency;
/* 28 */ @property (nonatomic, strong, readwrite) NBPhoneNumberDesc *voicemail;
/* 24 */ @property (nonatomic, strong, readwrite) NBPhoneNumberDesc *noInternationalDialling;
/* 9 */ @property (nonatomic, strong, readwrite) NSString *codeID;
/* 10 */ @property (nonatomic, assign, readwrite) UInt32 countryCode;
/* 11 */ @property (nonatomic, strong, readwrite) NSString *internationalPrefix;
/* 17 */ @property (nonatomic, strong, readwrite) NSString *preferredInternationalPrefix;
/* 12 */ @property (nonatomic, strong, readwrite) NSString *nationalPrefix;
/* 13 */ @property (nonatomic, strong, readwrite) NSString *preferredExtnPrefix;
/* 15 */ @property (nonatomic, strong, readwrite) NSString *nationalPrefixForParsing;
/* 16 */ @property (nonatomic, strong, readwrite) NSString *nationalPrefixTransformRule;
/* 18 */ @property (nonatomic, assign, readwrite) BOOL sameMobileAndFixedLinePattern;
/* 19 */ @property (nonatomic, strong, readwrite) NSMutableArray *numberFormats;
/* 20 */ @property (nonatomic, strong, readwrite) NSMutableArray *intlNumberFormats;
/* 22 */ @property (nonatomic, assign, readwrite) BOOL mainCountryForCode;
/* 23 */ @property (nonatomic, strong, readwrite) NSString *leadingDigits;
/* 26 */ @property (nonatomic, assign, readwrite) BOOL leadingZeroPossible;
- (void)buildData:(id)data;
@end

166
libPhoneNumber/NBPhoneMetaData.m Executable file
View File

@ -0,0 +1,166 @@
//
// NBPhoneMetaData.m
// libPhoneNumber
//
// Created by NHN Corp. Last Edited by BAND dev team (band_dev@nhn.com)
//
#import "NBPhoneMetaData.h"
#import "NBPhoneNumberDesc.h"
#import "NBNumberFormat.h"
#import "NSArray+NBAdditions.h"
@implementation NBPhoneMetaData
@synthesize generalDesc, fixedLine, mobile, tollFree, premiumRate, sharedCost, personalNumber, voip, pager, uan, emergency, voicemail, noInternationalDialling;
@synthesize codeID, countryCode;
@synthesize internationalPrefix, preferredInternationalPrefix, nationalPrefix, preferredExtnPrefix, nationalPrefixForParsing, nationalPrefixTransformRule, sameMobileAndFixedLinePattern, numberFormats, intlNumberFormats, mainCountryForCode, leadingDigits, leadingZeroPossible;
- (id)init
{
self = [super init];
if (self)
{
[self setNumberFormats:[[NSMutableArray alloc] init]];
[self setIntlNumberFormats:[[NSMutableArray alloc] init]];
self.leadingZeroPossible = NO;
self.mainCountryForCode = NO;
}
return self;
}
- (NSString *)description
{
return [NSString stringWithFormat:@"* codeID[%@] countryCode[%u] generalDesc[%@] fixedLine[%@] mobile[%@] tollFree[%@] premiumRate[%@] sharedCost[%@] personalNumber[%@] voip[%@] pager[%@] uan[%@] emergency[%@] voicemail[%@] noInternationalDialling[%@] internationalPrefix[%@] preferredInternationalPrefix[%@] nationalPrefix[%@] preferredExtnPrefix[%@] nationalPrefixForParsing[%@] nationalPrefixTransformRule[%@] sameMobileAndFixedLinePattern[%@] numberFormats[%@] intlNumberFormats[%@] mainCountryForCode[%@] leadingDigits[%@] leadingZeroPossible[%@]",
self.codeID, (unsigned int)self.countryCode, self.generalDesc, self.fixedLine, self.mobile, self.tollFree, self.premiumRate, self.sharedCost, self.personalNumber, self.voip, self.pager, self.uan, self.emergency, self.voicemail, self.noInternationalDialling, self.internationalPrefix, self.preferredInternationalPrefix, self.nationalPrefix, self.preferredExtnPrefix, self.nationalPrefixForParsing, self.nationalPrefixTransformRule, self.sameMobileAndFixedLinePattern?@"Y":@"N", self.numberFormats, self.intlNumberFormats, self.mainCountryForCode?@"Y":@"N", self.leadingDigits, self.leadingZeroPossible?@"Y":@"N"];
}
- (void)buildData:(id)data
{
if (data != nil && [data isKindOfClass:[NSArray class]] )
{
/* 1 */ self.generalDesc = [[NBPhoneNumberDesc alloc] initWithData:[data safeObjectAtIndex:1]];
/* 2 */ self.fixedLine = [[NBPhoneNumberDesc alloc] initWithData:[data safeObjectAtIndex:2]];
/* 3 */ self.mobile = [[NBPhoneNumberDesc alloc] initWithData:[data safeObjectAtIndex:3]];
/* 4 */ self.tollFree = [[NBPhoneNumberDesc alloc] initWithData:[data safeObjectAtIndex:4]];
/* 5 */ self.premiumRate = [[NBPhoneNumberDesc alloc] initWithData:[data safeObjectAtIndex:5]];
/* 6 */ self.sharedCost = [[NBPhoneNumberDesc alloc] initWithData:[data safeObjectAtIndex:6]];
/* 7 */ self.personalNumber = [[NBPhoneNumberDesc alloc] initWithData:[data safeObjectAtIndex:7]];
/* 8 */ self.voip = [[NBPhoneNumberDesc alloc] initWithData:[data safeObjectAtIndex:8]];
/* 21 */ self.pager = [[NBPhoneNumberDesc alloc] initWithData:[data safeObjectAtIndex:21]];
/* 25 */ self.uan = [[NBPhoneNumberDesc alloc] initWithData:[data safeObjectAtIndex:25]];
/* 27 */ self.emergency = [[NBPhoneNumberDesc alloc] initWithData:[data safeObjectAtIndex:27]];
/* 28 */ self.voicemail = [[NBPhoneNumberDesc alloc] initWithData:[data safeObjectAtIndex:28]];
/* 24 */ self.noInternationalDialling = [[NBPhoneNumberDesc alloc] initWithData:[data safeObjectAtIndex:24]];
/* 9 */ self.codeID = [data safeObjectAtIndex:9];
/* 10 */ self.countryCode = (UInt32)[[data safeObjectAtIndex:10] intValue];
/* 11 */ self.internationalPrefix = [data safeObjectAtIndex:11];
/* 17 */ self.preferredInternationalPrefix = [data safeObjectAtIndex:17];
/* 12 */ self.nationalPrefix = [data safeObjectAtIndex:12];
/* 13 */ self.preferredExtnPrefix = [data safeObjectAtIndex:13];
/* 15 */ self.nationalPrefixForParsing = [data safeObjectAtIndex:15];
/* 16 */ self.nationalPrefixTransformRule = [data safeObjectAtIndex:16];
/* 18 */ self.sameMobileAndFixedLinePattern = [[data safeObjectAtIndex:18] boolValue];
/* 19 */ self.numberFormats = [self numberFormatArrayFromData:[data safeObjectAtIndex:19]]; // NBNumberFormat array
/* 20 */ self.intlNumberFormats = [self numberFormatArrayFromData:[data safeObjectAtIndex:20]]; // NBNumberFormat array
/* 22 */ self.mainCountryForCode = [[data safeObjectAtIndex:22] boolValue];
/* 23 */ self.leadingDigits = [data safeObjectAtIndex:23];
/* 26 */ self.leadingZeroPossible = [[data safeObjectAtIndex:26] boolValue];
}
else
{
NSLog(@"nil data or wrong data type");
}
}
- (id)initWithCoder:(NSCoder*)coder
{
if (self = [super init])
{
self.generalDesc = [coder decodeObjectForKey:@"generalDesc"];
self.fixedLine = [coder decodeObjectForKey:@"fixedLine"];
self.mobile = [coder decodeObjectForKey:@"mobile"];
self.tollFree = [coder decodeObjectForKey:@"tollFree"];
self.premiumRate = [coder decodeObjectForKey:@"premiumRate"];
self.sharedCost = [coder decodeObjectForKey:@"sharedCost"];
self.personalNumber = [coder decodeObjectForKey:@"personalNumber"];
self.voip = [coder decodeObjectForKey:@"voip"];
self.pager = [coder decodeObjectForKey:@"pager"];
self.uan = [coder decodeObjectForKey:@"uan"];
self.emergency = [coder decodeObjectForKey:@"emergency"];
self.voicemail = [coder decodeObjectForKey:@"voicemail"];
self.noInternationalDialling = [coder decodeObjectForKey:@"noInternationalDialling"];
self.codeID = [coder decodeObjectForKey:@"codeID"];
self.countryCode = [[coder decodeObjectForKey:@"countryCode"] longValue];
self.internationalPrefix = [coder decodeObjectForKey:@"internationalPrefix"];
self.preferredInternationalPrefix = [coder decodeObjectForKey:@"preferredInternationalPrefix"];
self.nationalPrefix = [coder decodeObjectForKey:@"nationalPrefix"];
self.preferredExtnPrefix = [coder decodeObjectForKey:@"preferredExtnPrefix"];
self.nationalPrefixForParsing = [coder decodeObjectForKey:@"nationalPrefixForParsing"];
self.nationalPrefixTransformRule = [coder decodeObjectForKey:@"nationalPrefixTransformRule"];
self.sameMobileAndFixedLinePattern = [[coder decodeObjectForKey:@"sameMobileAndFixedLinePattern"] boolValue];
self.numberFormats = [coder decodeObjectForKey:@"numberFormats"];
self.intlNumberFormats = [coder decodeObjectForKey:@"intlNumberFormats"];
self.mainCountryForCode = [[coder decodeObjectForKey:@"mainCountryForCode"] boolValue];
self.leadingDigits = [coder decodeObjectForKey:@"leadingDigits"];
self.leadingZeroPossible = [[coder decodeObjectForKey:@"leadingZeroPossible"] boolValue];
}
return self;
}
- (void)encodeWithCoder:(NSCoder*)coder
{
[coder encodeObject:self.generalDesc forKey:@"generalDesc"];
[coder encodeObject:self.fixedLine forKey:@"fixedLine"];
[coder encodeObject:self.mobile forKey:@"mobile"];
[coder encodeObject:self.tollFree forKey:@"tollFree"];
[coder encodeObject:self.premiumRate forKey:@"premiumRate"];
[coder encodeObject:self.sharedCost forKey:@"sharedCost"];
[coder encodeObject:self.personalNumber forKey:@"personalNumber"];
[coder encodeObject:self.voip forKey:@"voip"];
[coder encodeObject:self.pager forKey:@"pager"];
[coder encodeObject:self.uan forKey:@"uan"];
[coder encodeObject:self.emergency forKey:@"emergency"];
[coder encodeObject:self.voicemail forKey:@"voicemail"];
[coder encodeObject:self.noInternationalDialling forKey:@"noInternationalDialling"];
[coder encodeObject:self.codeID forKey:@"codeID"];
[coder encodeObject:[NSNumber numberWithLong:self.countryCode] forKey:@"countryCode"];
[coder encodeObject:self.internationalPrefix forKey:@"internationalPrefix"];
[coder encodeObject:self.preferredInternationalPrefix forKey:@"preferredInternationalPrefix"];
[coder encodeObject:self.nationalPrefix forKey:@"nationalPrefix"];
[coder encodeObject:self.preferredExtnPrefix forKey:@"preferredExtnPrefix"];
[coder encodeObject:self.nationalPrefixForParsing forKey:@"nationalPrefixForParsing"];
[coder encodeObject:self.nationalPrefixTransformRule forKey:@"nationalPrefixTransformRule"];
[coder encodeObject:[NSNumber numberWithBool:self.sameMobileAndFixedLinePattern] forKey:@"sameMobileAndFixedLinePattern"];
[coder encodeObject:self.numberFormats forKey:@"numberFormats"];
[coder encodeObject:self.intlNumberFormats forKey:@"intlNumberFormats"];
[coder encodeObject:[NSNumber numberWithBool:self.mainCountryForCode] forKey:@"mainCountryForCode"];
[coder encodeObject:self.leadingDigits forKey:@"leadingDigits"];
[coder encodeObject:[NSNumber numberWithBool:self.leadingZeroPossible] forKey:@"leadingZeroPossible"];
}
- (NSMutableArray*)numberFormatArrayFromData:(id)data
{
NSMutableArray *resArray = [[NSMutableArray alloc] init];
if (data != nil && [data isKindOfClass:[NSArray class]])
{
for (id numFormat in data)
{
NBNumberFormat *newNumberFormat = [[NBNumberFormat alloc] initWithData:numFormat];
[resArray addObject:newNumberFormat];
}
}
return resArray;
}
@end

View File

@ -0,0 +1,14 @@
//
// NBPhoneMetaDataGenerator.h
// libPhoneNumber
//
// Created by NHN Corp. Last Edited by BAND dev team (band_dev@nhn.com)
//
#import <Foundation/Foundation.h>
@interface NBPhoneMetaDataGenerator : NSObject
- (void)generateMetadataClasses;
@end

View File

@ -0,0 +1,361 @@
//
// NBPhoneMetaDataGenerator.m
// libPhoneNumber
//
// Created by NHN Corp. Last Edited by BAND dev team (band_dev@nhn.com)
//
#import "NBPhoneMetaDataGenerator.h"
#import "NBPhoneMetaData.h"
#define INDENT_TAB @" "
NSString *letters = @"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
@implementation NBPhoneMetaDataGenerator
- (id)init
{
self = [super init];
if (self)
{
}
return self;
}
- (void)generateMetadataClasses
{
NSDictionary *realMetadata = nil, *testMetadata = nil;
realMetadata = [self generateMetaData];
testMetadata = [self generateMetaDataWithTest];
@try
{
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *dataPath = [documentsDirectory stringByAppendingPathComponent:@"src"];
if (![[NSFileManager defaultManager] fileExistsAtPath:dataPath])
{
NSError* error;
if( [[NSFileManager defaultManager] createDirectoryAtPath:dataPath withIntermediateDirectories:NO attributes:nil error:&error])
{
}
else
{
NSLog(@"[%@] ERROR: attempting to write create MyFolder directory", [self class]);
}
}
NSDictionary *mappedRealData = [self mappingObject:realMetadata];
NSDictionary *mappedTestData = [self mappingObject:testMetadata];
[self createClassWithDictionary:mappedRealData name:@"NBPhoneNumberMetadata"];
[self createClassWithDictionary:mappedTestData name:@"NBPhoneNumberMetadataForTesting"];
}
@catch (NSException *exception)
{
NSLog(@"Error for creating metadata classes : %@", exception.reason);
}
}
- (void)createClassWithDictionary:(NSDictionary*)data name:(NSString*)name
{
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *dataPath = [documentsDirectory stringByAppendingPathComponent:@"src"];
NSString *filePathData = [NSString stringWithFormat:@"%@/%@.plist", dataPath, name];
NSData *objData = [NSKeyedArchiver archivedDataWithRootObject:data];
[objData writeToFile:filePathData atomically:YES];
/*
NSString *codeStringHeader = [self generateSourceCodeWith:data name:name type:0];
NSString *codeStringSource = [self generateSourceCodeWith:data name:name type:1];
NSData *dataToWrite = [codeStringHeader dataUsingEncoding:NSUTF8StringEncoding];
[fileManager createFileAtPath:filePathHeader contents:dataToWrite attributes:nil];
dataToWrite = [codeStringSource dataUsingEncoding:NSUTF8StringEncoding];
[fileManager createFileAtPath:filePathSource contents:dataToWrite attributes:nil];
*/
NSData *fileData = [NSData dataWithContentsOfFile:filePathData];
NSDictionary *unarchiveData = [NSKeyedUnarchiver unarchiveObjectWithData:fileData];
NSLog(@"Created file to...[%@ / %d]", filePathData, [unarchiveData count]);
}
- (NSDictionary*)mappingObject:(NSDictionary*)parsedJSONData
{
NSMutableDictionary *resMedata = [[NSMutableDictionary alloc] init];
NSDictionary *countryCodeToRegionCodeMap = [parsedJSONData objectForKey:@"countryCodeToRegionCodeMap"];
NSDictionary *countryToMetadata = [parsedJSONData objectForKey:@"countryToMetadata"];
NSLog(@"- countryCodeToRegionCodeMap count [%d]", [countryCodeToRegionCodeMap count]);
NSLog(@"- countryToMetadata count [%d]", [countryToMetadata count]);
NSMutableDictionary *genetatedMetaData = [[NSMutableDictionary alloc] init];
for (id key in [countryToMetadata allKeys])
{
id metaData = [countryToMetadata objectForKey:key];
NBPhoneMetaData *newMetaData = [[NBPhoneMetaData alloc] init];
[newMetaData buildData:metaData];
[genetatedMetaData setObject:newMetaData forKey:key];
}
[resMedata setObject:countryCodeToRegionCodeMap forKey:@"countryCodeToRegionCodeMap"];
[resMedata setObject:genetatedMetaData forKey:@"countryToMetadata"];
return resMedata;
}
- (NSString *)genRandStringLength:(int)len
{
NSMutableString *randomString = [NSMutableString stringWithCapacity: len];
for (int i=0; i<len; i++) {
[randomString appendFormat: @"%C", [letters characterAtIndex: arc4random() % [letters length]]];
}
return randomString;
}
- (NSString*)indentTab:(int)depth
{
NSMutableString *resTab = [[NSMutableString alloc] initWithString:@""];
for (int i=0; i<depth; i++)
{
[resTab appendString:INDENT_TAB];
}
return resTab;
}
- (NSString *)documentsDirectory
{
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
return [paths objectAtIndex:0];
}
- (NSDictionary *)generateMetaData
{
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"PhoneNumberMetaData" ofType:@"json"];
return [self parseJSON:filePath];
}
- (NSDictionary *)generateMetaDataWithTest
{
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"PhoneNumberMetaDataForTesting" ofType:@"json"];
return [self parseJSON:filePath];
}
- (NSDictionary *)parseJSON:(NSString*)filePath
{
NSDictionary *jsonRes = nil;
@try {
NSData *jsonData = [NSData dataWithContentsOfFile:filePath];
NSError *error = nil;
jsonRes = [NSJSONSerialization JSONObjectWithData:jsonData options:kNilOptions error:&error];
}
@catch (NSException *exception) {
NSLog(@"Error : %@", exception.reason);
}
return jsonRes;
}
/*
- (NSString *)generateSourceCodeWith:(NSDictionary*)data name:(NSString*)name type:(int)type
{
NSString *srcCode = @"";
if (type == 0)
{
NSString *curDir = [[NSFileManager defaultManager] currentDirectoryPath];
NSString *filePath = [NSString stringWithFormat:@"%@/%@", curDir, @"resources/PhoneNumberTemplateClass.h"];
NSString *stringContent = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil];
// header code
srcCode = [NSString stringWithFormat:stringContent, name, name];
}
else if (type == 1)
{
NSMutableString *srcImplement = [[NSMutableString alloc] initWithString:@""];
NSString *curDir = [[NSFileManager defaultManager] currentDirectoryPath];
NSString *filePath = [NSString stringWithFormat:@"%@/%@", curDir, @"resources/PhoneNumberTemplateClass.m"];
NSString *stringContent = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil];
// source code
NSString *instanceName = @"";
[srcImplement appendString:[self encodeNSDictionary:data indent:0 createdInstanceName:&instanceName]];
srcCode = [NSString stringWithFormat:stringContent, name, name, name, srcImplement, instanceName];
}
return srcCode;
}
- (NSString*)encodeNSDictionary:(NSDictionary*)object indent:(int)depth createdInstanceName:(NSString**)instanceName
{
NSMutableString *curImplement = [[NSMutableString alloc] initWithString:@""];
NSEnumerator *enumerator = [object keyEnumerator];
id curKey = nil;
NSString *tempInstanceName = [NSString stringWithFormat:@"%@_%@_%d", [self genRandStringLength:16], @"NSDictionary", depth];
if (instanceName != NULL && (*instanceName) != nil)
(*instanceName) = [tempInstanceName copy];
NSString *createInstancFromat = @"%@NSMutableDictionary *%@ = [[NSMutableDictionary alloc] init];\n";
NSString *currentSyntaxFormat = nil;
NSString *buildedSyntax = nil;
[curImplement appendFormat:createInstancFromat, [self indentTab:depth], tempInstanceName];
while ((curKey = [enumerator nextObject]))
{
id curObject = [object objectForKey:curKey];
currentSyntaxFormat = @"%@[%@ setObject:%@ forKey:@\"%@\"];\n";
if ([curObject isKindOfClass:[NSString class]])
{
[curImplement appendFormat:currentSyntaxFormat, [self indentTab:depth], tempInstanceName, [self encodeNSString:curObject], curKey];
}
else if ([curObject isKindOfClass:[NSArray class]])
{
[curImplement appendFormat:@"%@{\n", [self indentTab:depth]];
NSString *tempArrayInstanceName = @"";
buildedSyntax = [self encodeNSArray:curObject indent:depth+1 createdInstanceName:&tempArrayInstanceName];
[curImplement appendString:buildedSyntax];
[curImplement appendString:[NSString stringWithFormat:currentSyntaxFormat, [self indentTab:depth + 1], tempInstanceName, tempArrayInstanceName, curKey]];
[curImplement appendFormat:@"%@}\n", [self indentTab:depth]];
}
else if ([curObject isKindOfClass:[NSDictionary class]])
{
[curImplement appendFormat:@"%@{\n", [self indentTab:depth]];
NSString *tempDictionaryInstanceName = @"";
buildedSyntax = [self encodeNSDictionary:curObject indent:depth+1 createdInstanceName:&tempDictionaryInstanceName];
[curImplement appendString:buildedSyntax];
[curImplement appendString:[NSString stringWithFormat:currentSyntaxFormat, [self indentTab:depth + 1], tempInstanceName, tempDictionaryInstanceName, curKey]];
[curImplement appendFormat:@"%@}\n", [self indentTab:depth]];
}
else if ([curObject isKindOfClass:[NSNumber class]])
{
[curImplement appendFormat:currentSyntaxFormat, [self indentTab:depth], tempInstanceName, [self encodeNSNumber:curObject], curKey];
}
else if ([curObject isKindOfClass:[NSNull class]])
{
[curImplement appendFormat:currentSyntaxFormat, [self indentTab:depth], tempInstanceName, [self encodeNSNull:curObject], curKey];
}
else
{
NSString *warningString = [NSString stringWithFormat:@"#warning cant parse data %@ key %@", curObject, curKey];
[curImplement appendString:warningString];
NSLog(@"!!! ERROR !!! - %@", warningString);
}
}
return curImplement;
}
- (NSString*)encodeNSArray:(NSArray*)object indent:(int)depth createdInstanceName:(NSString**)instanceName
{
NSMutableString *curImplement = [[NSMutableString alloc] initWithString:@""];
NSString *tempInstanceName = [NSString stringWithFormat:@"%@_%@_%d", [self genRandStringLength:16], @"NSArray", depth];
if (instanceName != NULL && (*instanceName) != nil)
(*instanceName) = [tempInstanceName copy];
NSString *createInstancFromat = @"%@NSMutableArray *%@ = [[NSMutableArray alloc] init];\n";
NSString *currentSyntaxFormat = nil;
NSString *buildedSyntax = nil;
[curImplement appendFormat:createInstancFromat, [self indentTab:depth], tempInstanceName];
for (id data in object)
{
currentSyntaxFormat = @"%@[%@ addObject:%@];\n";
if ([data isKindOfClass:[NSString class]])
{
[curImplement appendFormat:currentSyntaxFormat, [self indentTab:depth], tempInstanceName, [self encodeNSString:data]];
}
else if ([data isKindOfClass:[NSNumber class]])
{
[curImplement appendFormat:currentSyntaxFormat, [self indentTab:depth], tempInstanceName, [self encodeNSNumber:data]];
}
else if ([data isKindOfClass:[NSArray class]])
{
[curImplement appendFormat:@"%@{\n", [self indentTab:depth]];
NSString *tempArrayInstanceName = @"";
buildedSyntax = [self encodeNSArray:data indent:depth+1 createdInstanceName:&tempArrayInstanceName];
[curImplement appendString:buildedSyntax];
[curImplement appendString:[NSString stringWithFormat:currentSyntaxFormat, [self indentTab:depth + 1], tempInstanceName, tempArrayInstanceName]];
[curImplement appendFormat:@"%@}\n", [self indentTab:depth]];
}
else if ([data isKindOfClass:[NSDictionary class]])
{
[curImplement appendFormat:@"%@{\n", [self indentTab:depth]];
NSString *tempDictionaryInstanceName = @"";
buildedSyntax = [self encodeNSDictionary:data indent:depth+1 createdInstanceName:&tempDictionaryInstanceName];
[curImplement appendString:buildedSyntax];
[curImplement appendString:[NSString stringWithFormat:currentSyntaxFormat, [self indentTab:depth + 1], tempInstanceName, tempDictionaryInstanceName]];
[curImplement appendFormat:@"%@}\n", [self indentTab:depth]];
}
else if ([data isKindOfClass:[NSNull class]])
{
[curImplement appendFormat:currentSyntaxFormat, [self indentTab:depth], tempInstanceName, [self encodeNSNull:data]];
}
else
{
NSString *warningString = [NSString stringWithFormat:@"#warning cant parse data %@ class %@", data, [data class]];
[curImplement appendString:warningString];
NSLog(@"!!! ERROR !!! - %@", warningString);
}
}
return curImplement;
}
- (NSString*)encodeNSNull:(NSNull*)object
{
return [NSString stringWithFormat:@"%@", @"[NSNull null]"];
}
- (NSString*)encodeNSString:(NSString*)object
{
return [NSString stringWithFormat:@"@\"%@\"", [object stringByReplacingOccurrencesOfString:@"\\" withString:@"\\\\"]];
}
- (NSString*)encodeNSNumber:(NSNumber*)object
{
return [NSString stringWithFormat:@"[NSNumber numberWithLongLong:%@]", object];
}
*/
@end

25
libPhoneNumber/NBPhoneNumber.h Executable file
View File

@ -0,0 +1,25 @@
//
// NBPhoneNumber.h
// libPhoneNumber
//
// Created by NHN Corp. Last Edited by BAND dev team (band_dev@nhn.com)
//
#import <Foundation/Foundation.h>
#import "NBPhoneNumberDefines.h"
@interface NBPhoneNumber : NSObject <NSCopying>
// from phonemetadata.pb.js
/* 1 */ @property (nonatomic, assign, readwrite) UInt32 countryCode;
/* 2 */ @property (nonatomic, assign, readwrite) UInt64 nationalNumber;
/* 3 */ @property (nonatomic, strong, readwrite) NSString *extension;
/* 4 */ @property (nonatomic, assign, readwrite) BOOL italianLeadingZero;
/* 5 */ @property (nonatomic, strong, readwrite) NSString *rawInput;
/* 6 */ @property (nonatomic, strong, readwrite) NSNumber *countryCodeSource;
/* 7 */ @property (nonatomic, strong, readwrite) NSString *preferredDomesticCarrierCode;
- (void)clearCountryCodeSource;
- (NBECountryCodeSource)getCountryCodeSourceOrDefault;
@end

121
libPhoneNumber/NBPhoneNumber.m Executable file
View File

@ -0,0 +1,121 @@
//
// NBPhoneNumber.m
// libPhoneNumber
//
// Created by NHN Corp. Last Edited by BAND dev team (band_dev@nhn.com)
//
#import "NBPhoneNumber.h"
#import "NBPhoneNumberDefines.h"
@implementation NBPhoneNumber
@synthesize countryCode, nationalNumber, extension, italianLeadingZero, rawInput, countryCodeSource, preferredDomesticCarrierCode;
- (id)init
{
self = [super init];
if (self)
{
self.countryCodeSource = nil;
self.italianLeadingZero = NO;
self.nationalNumber = -1;
self.countryCode = -1;
}
return self;
}
- (void)clearCountryCodeSource
{
[self setCountryCodeSource:nil];
}
- (NBECountryCodeSource)getCountryCodeSourceOrDefault
{
if (self.countryCodeSource == nil)
return NBECountryCodeSourceFROM_NUMBER_WITH_PLUS_SIGN;
return [self.countryCodeSource intValue];
}
- (BOOL)isEqualToObject:(NBPhoneNumber*)otherObj
{
return [self isEqual:otherObj];
}
- (NSUInteger)hash
{
NSData *selfObject = [NSKeyedArchiver archivedDataWithRootObject:self];
return [selfObject hash];
}
- (BOOL)isEqual:(id)object
{
if ([object isKindOfClass:[NBPhoneNumber class]] == NO)
return NO;
NBPhoneNumber *other = object;
return (self.countryCode == other.countryCode) && (self.nationalNumber == other.nationalNumber) &&
(self.italianLeadingZero == other.italianLeadingZero) &&
((self.extension == nil && other.extension == nil) || [self.extension isEqualToString:other.extension]);
}
- (id)copyWithZone:(NSZone *)zone
{
NBPhoneNumber *phoneNumberCopy = [[NBPhoneNumber allocWithZone:zone] init];
phoneNumberCopy.countryCode = self.countryCode;
phoneNumberCopy.nationalNumber = self.nationalNumber;
phoneNumberCopy.extension = [self.extension copy];
phoneNumberCopy.italianLeadingZero = self.italianLeadingZero;
phoneNumberCopy.rawInput = [self.rawInput copy];
phoneNumberCopy.countryCodeSource = [self.countryCodeSource copy];
phoneNumberCopy.preferredDomesticCarrierCode = [self.preferredDomesticCarrierCode copy];
return phoneNumberCopy;
}
- (id)initWithCoder:(NSCoder*)coder
{
if (self = [super init])
{
self.countryCode = [[coder decodeObjectForKey:@"countryCode"] longValue];
self.nationalNumber = [[coder decodeObjectForKey:@"nationalNumber"] longLongValue];
self.extension = [coder decodeObjectForKey:@"extension"];
self.italianLeadingZero = [[coder decodeObjectForKey:@"italianLeadingZero"] boolValue];
self.rawInput = [coder decodeObjectForKey:@"rawInput"];
self.countryCodeSource = [coder decodeObjectForKey:@"countryCodeSource"];
self.preferredDomesticCarrierCode = [coder decodeObjectForKey:@"preferredDomesticCarrierCode"];
}
return self;
}
- (void)encodeWithCoder:(NSCoder*)coder
{
[coder encodeObject:[NSNumber numberWithLong:self.countryCode] forKey:@"countryCode"];
[coder encodeObject:[NSNumber numberWithLongLong:self.nationalNumber] forKey:@"nationalNumber"];
[coder encodeObject:self.extension forKey:@"extension"];
[coder encodeObject:[NSNumber numberWithBool:self.italianLeadingZero] forKey:@"italianLeadingZero"];
[coder encodeObject:self.rawInput forKey:@"rawInput"];
[coder encodeObject:self.countryCodeSource forKey:@"countryCodeSource"];
[coder encodeObject:self.preferredDomesticCarrierCode forKey:@"preferredDomesticCarrierCode"];
}
- (NSString *)description
{
return [NSString stringWithFormat:@" - countryCode[%u], nationalNumber[%llu], extension[%@], italianLeadingZero[%@], rawInput[%@] countryCodeSource[%d] preferredDomesticCarrierCode[%@]", (unsigned int)self.countryCode, self.nationalNumber, self.extension, self.italianLeadingZero?@"Y":@"N", self.rawInput, [self.countryCodeSource intValue], self.preferredDomesticCarrierCode];
}
@end

View File

@ -0,0 +1,81 @@
//
// NBPhoneNumberDefines.h
// libPhoneNumber
//
// Created by NHN Corp. Last Edited by BAND dev team (band_dev@nhn.com)
//
#ifndef libPhoneNumber_NBPhoneNumberDefines_h
#define libPhoneNumber_NBPhoneNumberDefines_h
#define NB_YES [NSNumber numberWithBool:YES]
#define NB_NO [NSNumber numberWithBool:NO]
#pragma mark - Enum -
typedef enum {
NBEPhoneNumberFormatE164 = 0,
NBEPhoneNumberFormatINTERNATIONAL = 1,
NBEPhoneNumberFormatNATIONAL = 2,
NBEPhoneNumberFormatRFC3966 = 3
} NBEPhoneNumberFormat;
typedef enum {
NBEPhoneNumberTypeFIXED_LINE = 0,
NBEPhoneNumberTypeMOBILE = 1,
// In some regions (e.g. the USA), it is impossible to distinguish between
// fixed-line and mobile numbers by looking at the phone number itself.
NBEPhoneNumberTypeFIXED_LINE_OR_MOBILE = 2,
// Freephone lines
NBEPhoneNumberTypeTOLL_FREE = 3,
NBEPhoneNumberTypePREMIUM_RATE = 4,
// The cost of this call is shared between the caller and the recipient, and
// is hence typically less than PREMIUM_RATE calls. See
// http://en.wikipedia.org/wiki/Shared_Cost_Service for more information.
NBEPhoneNumberTypeSHARED_COST = 5,
// Voice over IP numbers. This includes TSoIP (Telephony Service over IP).
NBEPhoneNumberTypeVOIP = 6,
// A personal number is associated with a particular person, and may be routed
// to either a MOBILE or FIXED_LINE number. Some more information can be found
// here = http://en.wikipedia.org/wiki/Personal_Numbers
NBEPhoneNumberTypePERSONAL_NUMBER = 7,
NBEPhoneNumberTypePAGER = 8,
// Used for 'Universal Access Numbers' or 'Company Numbers'. They may be
// further routed to specific offices, but allow one number to be used for a
// company.
NBEPhoneNumberTypeUAN = 9,
// Used for 'Voice Mail Access Numbers'.
NBEPhoneNumberTypeVOICEMAIL = 10,
// A phone number is of type UNKNOWN when it does not fit any of the known
// patterns for a specific region.
NBEPhoneNumberTypeUNKNOWN = -1
} NBEPhoneNumberType;
typedef enum {
NBEMatchTypeNOT_A_NUMBER = 0,
NBEMatchTypeNO_MATCH = 1,
NBEMatchTypeSHORT_NSN_MATCH = 2,
NBEMatchTypeNSN_MATCH = 3,
NBEMatchTypeEXACT_MATCH = 4
} NBEMatchType;
typedef enum {
NBEValidationResultUNKNOWN = 0,
NBEValidationResultIS_POSSIBLE = 1,
NBEValidationResultINVALID_COUNTRY_CODE = 2,
NBEValidationResultTOO_SHORT = 3,
NBEValidationResultTOO_LONG = 4
} NBEValidationResult;
typedef enum {
NBECountryCodeSourceFROM_NUMBER_WITH_PLUS_SIGN = 1,
NBECountryCodeSourceFROM_NUMBER_WITH_IDD = 5,
NBECountryCodeSourceFROM_NUMBER_WITHOUT_PLUS_SIGN = 10,
NBECountryCodeSourceFROM_DEFAULT_COUNTRY = 20
} NBECountryCodeSource;
#endif

View File

@ -0,0 +1,19 @@
//
// NBPhoneNumberDesc.h
// libPhoneNumber
//
// Created by NHN Corp. Last Edited by BAND dev team (band_dev@nhn.com)
//
#import <Foundation/Foundation.h>
@interface NBPhoneNumberDesc : NSObject
// from phonemetadata.pb.js
/* 2 */ @property (nonatomic, strong, readwrite) NSString *nationalNumberPattern;
/* 3 */ @property (nonatomic, strong, readwrite) NSString *possibleNumberPattern;
/* 6 */ @property (nonatomic, strong, readwrite) NSString *exampleNumber;
- (id)initWithData:(id)data;
@end

View File

@ -0,0 +1,90 @@
//
// NBPhoneNumberDesc.m
// libPhoneNumber
//
// Created by NHN Corp. Last Edited by BAND dev team (band_dev@nhn.com)
//
#import "NBPhoneNumberDesc.h"
#import "NSArray+NBAdditions.h"
@implementation NBPhoneNumberDesc
@synthesize nationalNumberPattern, possibleNumberPattern, exampleNumber;
- (id)initWithData:(id)data
{
self = [self init];
if (self && data != nil && [data isKindOfClass:[NSArray class]])
{
/* 2 */ self.nationalNumberPattern = [data safeObjectAtIndex:2];
/* 3 */ self.possibleNumberPattern = [data safeObjectAtIndex:3];
/* 6 */ self.exampleNumber = [data safeObjectAtIndex:6];
}
return self;
}
- (id)init
{
self = [super init];
if (self)
{
}
return self;
}
- (id)initWithCoder:(NSCoder*)coder
{
if (self = [super init])
{
self.nationalNumberPattern = [coder decodeObjectForKey:@"nationalNumberPattern"];
self.possibleNumberPattern = [coder decodeObjectForKey:@"possibleNumberPattern"];
self.exampleNumber = [coder decodeObjectForKey:@"exampleNumber"];
}
return self;
}
- (void)encodeWithCoder:(NSCoder*)coder
{
[coder encodeObject:self.nationalNumberPattern forKey:@"nationalNumberPattern"];
[coder encodeObject:self.possibleNumberPattern forKey:@"possibleNumberPattern"];
[coder encodeObject:self.exampleNumber forKey:@"exampleNumber"];
}
- (NSString *)description
{
return [NSString stringWithFormat:@"nationalNumberPattern[%@] possibleNumberPattern[%@] exampleNumber[%@]", self.nationalNumberPattern, self.possibleNumberPattern, self.exampleNumber];
}
- (id)copyWithZone:(NSZone *)zone
{
NBPhoneNumberDesc *phoneDescCopy = [[NBPhoneNumberDesc allocWithZone:zone] init];
phoneDescCopy.nationalNumberPattern = [self.nationalNumberPattern copy];
phoneDescCopy.possibleNumberPattern = [self.possibleNumberPattern copy];
phoneDescCopy.exampleNumber = [self.exampleNumber copy];
return phoneDescCopy;
}
- (BOOL)isEqual:(id)object
{
if ([object isKindOfClass:[NBPhoneNumberDesc class]] == NO)
return NO;
NBPhoneNumberDesc *other = object;
return [self.nationalNumberPattern isEqual:other.nationalNumberPattern] &&
[self.possibleNumberPattern isEqual:other.possibleNumberPattern] &&
[self.exampleNumber isEqual:other.exampleNumber];
}
@end

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,115 @@
//
// NBPhoneNumberUtil.h
// Band
//
// Created by NHN Corp. Last Edited by BAND dev team (band_dev@nhn.com)
//
#import <Foundation/Foundation.h>
#import "NBPhoneNumberDefines.h"
extern NSString * const VALID_PUNCTUATION;
extern NSString * const VALID_DIGITS_STRING;
extern NSString * const PLUS_CHARS;
extern NSString * const REGION_CODE_FOR_NON_GEO_ENTITY;
@class NBPhoneMetaData, NBPhoneNumber;
@interface NBPhoneNumberUtil : NSObject
+ (NBPhoneNumberUtil*)sharedInstance;
+ (NBPhoneNumberUtil*)sharedInstanceForTest;
+ (NBPhoneNumberUtil*)sharedInstanceWithBundle:(NSBundle *)bundle;
+ (NBPhoneNumberUtil*)sharedInstanceForTestWithBundle:(NSBundle *)bundle;
// regular expressions
- (NSArray*)matchesByRegex:(NSString*)sourceString regex:(NSString*)pattern;
- (NSArray*)matchedStringByRegex:(NSString*)sourceString regex:(NSString*)pattern;
- (NSString*)replaceStringByRegex:(NSString*)sourceString regex:(NSString*)pattern withTemplate:(NSString*)templateString;
- (int)stringPositionByRegex:(NSString*)sourceString regex:(NSString*)pattern;
+ (NSString*)stringByTrimming:(NSString*)aString;
//- (NSString*)numbersOnly:(NSString*)phoneNumber;
- (NSArray*)regionCodeFromCountryCode:(UInt32)countryCodeNumber;
- (NSString*)countryCodeFromRegionCode:(NSString*)regionCode;
- (NSArray*)getAllMetadata;
// libPhoneNumber Util functions
- (NSString*)convertAlphaCharactersInNumber:(NSString*)number;
- (NSString*)normalizePhoneNumber:(NSString*)phoneNumber;
- (NSString*)normalizeDigitsOnly:(NSString*)number;
- (BOOL)isNumberGeographical:(NBPhoneNumber*)phoneNumber;
- (NSString*)extractPossibleNumber:(NSString*)phoneNumber;
- (UInt32)extractCountryCode:(NSString*)fullNumber nationalNumber:(NSString**)nationalNumber;
- (NSString *)countryCodeByCarrier;
- (NSString*)getNddPrefixForRegion:(NSString*)regionCode stripNonDigits:(BOOL)stripNonDigits;
- (NSString*)getNationalSignificantNumber:(NBPhoneNumber*)phoneNumber;
- (NBEPhoneNumberType)getNumberType:(NBPhoneNumber*)phoneNumber;
- (UInt32)getCountryCodeForRegion:(NSString*)regionCode;
- (NSString*)getRegionCodeForCountryCode:(UInt32)countryCallingCode;
- (NSArray*)getRegionCodesForCountryCode:(UInt32)countryCallingCode;
- (NSString*)getRegionCodeForNumber:(NBPhoneNumber*)phoneNumber;
- (NBPhoneNumber*)getExampleNumber:(NSString*)regionCode error:(NSError**)error;
- (NBPhoneNumber*)getExampleNumberForType:(NSString*)regionCode type:(NBEPhoneNumberType)type error:(NSError**)error;
- (NBPhoneNumber*)getExampleNumberForNonGeoEntity:(UInt32)countryCallingCode error:(NSError**)error;
- (NBPhoneMetaData*)getMetadataForNonGeographicalRegion:(UInt32)countryCallingCode;
- (NBPhoneMetaData*)getMetadataForRegion:(NSString*)regionCode;
- (BOOL)canBeInternationallyDialled:(NBPhoneNumber*)number error:(NSError**)error;
- (BOOL)truncateTooLongNumber:(NBPhoneNumber*)number;
- (BOOL)isValidNumber:(NBPhoneNumber*)number;
- (BOOL)isViablePhoneNumber:(NSString*)phoneNumber;
- (BOOL)isAlphaNumber:(NSString*)number;
- (BOOL)isValidNumberForRegion:(NBPhoneNumber*)number regionCode:(NSString*)regionCode;
- (BOOL)isNANPACountry:(NSString*)regionCode;
- (BOOL)isLeadingZeroPossible:(UInt32)countryCallingCode;
- (NBEValidationResult)isPossibleNumberWithReason:(NBPhoneNumber*)number error:(NSError**)error;
- (BOOL)isPossibleNumber:(NBPhoneNumber*)number error:(NSError**)error;
- (BOOL)isPossibleNumberString:(NSString*)number regionDialingFrom:(NSString*)regionDialingFrom error:(NSError**)error;
- (NBEMatchType)isNumberMatch:(id)firstNumberIn second:(id)secondNumberIn error:(NSError**)error;
- (int)getLengthOfGeographicalAreaCode:(NBPhoneNumber*)phoneNumber error:(NSError**)error;
- (int)getLengthOfNationalDestinationCode:(NBPhoneNumber*)phoneNumber error:(NSError**)error;
- (BOOL)maybeStripNationalPrefixAndCarrierCode:(NSString**)numberStr metadata:(NBPhoneMetaData*)metadata carrierCode:(NSString**)carrierCode;
- (NBECountryCodeSource)maybeStripInternationalPrefixAndNormalize:(NSString**)numberStr possibleIddPrefix:(NSString*)possibleIddPrefix;
- (UInt32)maybeExtractCountryCode:(NSString*)number metadata:(NBPhoneMetaData*)defaultRegionMetadata
nationalNumber:(NSString**)nationalNumber keepRawInput:(BOOL)keepRawInput phoneNumber:(NBPhoneNumber**)phoneNumber error:(NSError**)error;
- (NBPhoneNumber*)parse:(NSString*)numberToParse defaultRegion:(NSString*)defaultRegion error:(NSError**)error;
- (NBPhoneNumber*)parseAndKeepRawInput:(NSString*)numberToParse defaultRegion:(NSString*)defaultRegion error:(NSError**)error;
- (NBPhoneNumber*)parseWithPhoneCarrierRegion:(NSString*)numberToParse error:(NSError**)error;
- (NSString*)format:(NBPhoneNumber*)phoneNumber numberFormat:(NBEPhoneNumberFormat)numberFormat error:(NSError**)error;
- (NSString*)formatByPattern:(NBPhoneNumber*)number numberFormat:(NBEPhoneNumberFormat)numberFormat userDefinedFormats:(NSArray*)userDefinedFormats error:(NSError**)error;
- (NSString*)formatNumberForMobileDialing:(NBPhoneNumber*)number regionCallingFrom:(NSString*)regionCallingFrom withFormatting:(BOOL)withFormatting error:(NSError**)error;
- (NSString*)formatOutOfCountryCallingNumber:(NBPhoneNumber*)number regionCallingFrom:(NSString*)regionCallingFrom error:(NSError**)error;
- (NSString*)formatOutOfCountryKeepingAlphaChars:(NBPhoneNumber*)number regionCallingFrom:(NSString*)regionCallingFrom error:(NSError**)error;
- (NSString*)formatNationalNumberWithCarrierCode:(NBPhoneNumber*)number carrierCode:(NSString*)carrierCode error:(NSError**)error;
- (NSString*)formatInOriginalFormat:(NBPhoneNumber*)number regionCallingFrom:(NSString*)regionCallingFrom error:(NSError**)error;
- (NSString*)formatNationalNumberWithPreferredCarrierCode:(NBPhoneNumber*)number fallbackCarrierCode:(NSString*)fallbackCarrierCode error:(NSError**)error;
- (BOOL)formattingRuleHasFirstGroupOnly:(NSString*)nationalPrefixFormattingRule;
@property (nonatomic, strong, readonly) NSDictionary *DIGIT_MAPPINGS;
@property (nonatomic, strong, readonly) NSBundle *libPhoneBundle;
@end

4111
libPhoneNumber/NBPhoneNumberUtil.m Executable file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,15 @@
//
// NSArray+NBAdditions.h
// libPhoneNumber
//
// Created by Frane Bandov on 04.10.13.
// Copyright (c) 2013 NHN. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSArray (NBAdditions)
- (id)safeObjectAtIndex:(NSUInteger)index;
@end

View File

@ -0,0 +1,28 @@
//
// NSArray+NBAdditions.m
// libPhoneNumber
//
// Created by Frane Bandov on 04.10.13.
// Copyright (c) 2013 NHN. All rights reserved.
//
#import "NSArray+NBAdditions.h"
@implementation NSArray (NBAdditions)
- (id)safeObjectAtIndex:(NSUInteger)index
{
@synchronized(self)
{
if(index >= [self count]) return nil;
id res = [self objectAtIndex:index];
if (res == nil || (NSNull*)res == [NSNull null])
return nil;
return res;
}
}
@end

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,2 @@
/* Localized versions of Info.plist keys */

View File

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>com.nhn.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>

View File

@ -0,0 +1,14 @@
//
// Prefix header for all source files of the 'libPhoneNumber' target in the 'libPhoneNumber' project
//
#import <Availability.h>
#ifndef __IPHONE_3_0
#warning "This project uses features only available in iOS SDK 3.0 and later."
#endif
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#endif

17
libPhoneNumber/main.m Executable file
View File

@ -0,0 +1,17 @@
//
// main.m
// libPhoneNumber
//
// Created by NHN Corp. Last Edited by BAND dev team (band_dev@nhn.com)
//
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
int main(int argc, char *argv[])
{
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}

View File

@ -0,0 +1,13 @@
//
// NBAsYouTypeFormatterTest.h
// libPhoneNumber
//
// Created by ishtar on 13. 3. 5..
// Copyright (c) 2013년 NHN. All rights reserved.
//
#import <SenTestingKit/SenTestingKit.h>
@interface NBAsYouTypeFormatterTest : SenTestCase
@end

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,11 @@
//
// NBPhoneNumberUtilTests.h
// NBPhoneNumberUtilTests
//
// Created by NHN Corp. Last Edited by BAND dev team (band_dev@nhn.com)
//
#import <SenTestingKit/SenTestingKit.h>
@interface NBPhoneNumberUtilTests : SenTestCase
@end

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,2 @@
/* Localized versions of Info.plist keys */

53
libPhoneNumberTests/index.php Executable file
View File

@ -0,0 +1,53 @@
<!DOCTYPE html>
<html>
<?PHP
$mode = isset($_REQUEST['test']) ? true:false;
$metadataSrc = "./libphonenumber-read-only/javascript/i18n/phonenumbers/metadata.js";
$fileName = "PhoneNumberMetaData";
if ($mode)
{
$metadataSrc = "./libphonenumber-read-only/javascript/i18n/phonenumbers/metadatafortesting.js";
$fileName = "PhoneNumberMetaDataForTesting";
}
?>
<head>
<title>libPhoneNumber for iOS metadata generator</title>
<script src="http://closure-library.googlecode.com/svn/trunk/closure/goog/base.js"></script>
<script>
goog.require('goog.proto2.Message');
goog.require('goog.dom');
goog.require('goog.json');
goog.require('goog.array');
goog.require('goog.proto2.ObjectSerializer');
goog.require('goog.string.StringBuffer');
</script>
<script src="./libphonenumber-read-only/javascript/i18n/phonenumbers/phonemetadata.pb.js"></script>
<script src="./libphonenumber-read-only/javascript/i18n/phonenumbers/phonenumber.pb.js"></script>
<script src=<?PHP echo '"'.$metadataSrc.'"'; ?>></script>
<script src="./libphonenumber-read-only/javascript/i18n/phonenumbers/phonenumberutil.js"></script>
<script src="./libphonenumber-read-only/javascript/i18n/phonenumbers/asyoutypeformatter.js"></script>
<script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
<script>
goog.require('i18n.phonenumbers.metadata');
$(document).ready(function () {
var goodDomElement = goog.dom.getElement;
var jsonData = encodeURIComponent(JSON.stringify(i18n.phonenumbers.metadata));
$.ajax({
type: "POST",
url: "libPhoneNumberGenerator.php",
data: { jsonData: jsonData, fileName: <?php echo '"'.$fileName.'"'; ?> }
}).done(function(msg) {
$('#console').html(msg."");
});
});
</script>
</head>
<body>
<div id="console">Generate libPhoneNumber metadata for iOS</div>
</body>
</html>

View File

@ -0,0 +1,15 @@
<?PHP
$str = urldecode($_REQUEST['jsonData']);
$name = $_REQUEST['fileName'];
if ($str && $name)
{
$fp = fopen('./generatedJSON/'.$name.'.json', 'w');
fwrite($fp, $str);
fclose($fp);
echo "complete generate : ".$name;
exit;
}
echo "error";
?>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>com.nhn.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>

View File

@ -0,0 +1,7 @@
//
// Prefix header for all source files of the 'libPhoneNumberiOS' target in the 'libPhoneNumberiOS' project
//
#ifdef __OBJC__
#import <Foundation/Foundation.h>
#endif