From: Kyeonghun Lee Date: Mon, 3 Apr 2017 07:53:27 +0000 (+0900) Subject: Initial commit X-Git-Tag: submit/trunk/20170823.075128~89^2~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=aec68ae1044c31bc70c089962d2ee83545678d30;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git Initial commit Change-Id: I6e470bbe0b9e95c8a9833a10f0b800bfc325517a Signed-off-by: Kyeonghun Lee --- diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/LICENSE @@ -0,0 +1,202 @@ + + 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 + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/packaging/csapi-phonenumber-utils.manifest b/packaging/csapi-phonenumber-utils.manifest new file mode 100644 index 0000000..75b0fa5 --- /dev/null +++ b/packaging/csapi-phonenumber-utils.manifest @@ -0,0 +1,5 @@ + + + + + diff --git a/packaging/csapi-phonenumber-utils.spec b/packaging/csapi-phonenumber-utils.spec new file mode 100644 index 0000000..08fcdca --- /dev/null +++ b/packaging/csapi-phonenumber-utils.spec @@ -0,0 +1,44 @@ +Name: csapi-phonenumber-utils +Summary: Tizen Phonenumber Utils API for C# +Version: 1.0.0 +Release: 1 +Group: Development/Libraries +License: Apache-2.0 +URL: https://www.tizen.org +Source0: %{name}-%{version}.tar.gz +Source1: %{name}.manifest + +AutoReqProv: no +ExcludeArch: aarch64 %ix86 + +BuildRequires: dotnet-build-tools + +# C# API Requires +BuildRequires: csapi-tizen-nuget + +%define Assemblies Tizen.PhonenumberUtils + +%description +%{summary} + +%dotnet_import_sub_packages + +%prep +%setup -q +cp %{SOURCE1} . + +%build +for ASM in %{Assemblies}; do +%dotnet_build $ASM +%dotnet_pack $ASM/$ASM.nuspec %{version} +done + +%install +for ASM in %{Assemblies}; do +%dotnet_install $ASM +done + +%files +%manifest %{name}.manifest +%license LICENSE +%attr(644,root,root) %{dotnet_assembly_files} diff --git a/src/Tizen.PhonenumberUtils/Interop/Interop.Libraries.cs b/src/Tizen.PhonenumberUtils/Interop/Interop.Libraries.cs new file mode 100755 index 0000000..82c7dc1 --- /dev/null +++ b/src/Tizen.PhonenumberUtils/Interop/Interop.Libraries.cs @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string PhonenumberUtils = "libphonenumber-utils.so.0"; + } +} diff --git a/src/Tizen.PhonenumberUtils/Interop/Interop.PhonenumberUtils.cs b/src/Tizen.PhonenumberUtils/Interop/Interop.PhonenumberUtils.cs new file mode 100755 index 0000000..614b41a --- /dev/null +++ b/src/Tizen.PhonenumberUtils/Interop/Interop.PhonenumberUtils.cs @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class PhonenumberUtils + { + [DllImport(Libraries.PhonenumberUtils, EntryPoint = "phone_number_connect")] + internal static extern int Connect(); + + [DllImport(Libraries.PhonenumberUtils, EntryPoint = "phone_number_disconnect")] + internal static extern int Disconnect(); + + [DllImport(Libraries.PhonenumberUtils, EntryPoint = "phone_number_get_location_from_number")] + internal static extern int GetLocationFromNumber(string number, int region, int language, out string location); + + [DllImport(Libraries.PhonenumberUtils, EntryPoint = "phone_number_get_formatted_number")] + internal static extern int GetFormmatedNumber(string number, int region, out string normalizedNumber); + + [DllImport(Libraries.PhonenumberUtils, EntryPoint = "phone_number_get_normalized_number")] + internal static extern int GetNormailizedNumber(string number, out string normalizedNumber); + } +} diff --git a/src/Tizen.PhonenumberUtils/Properties/AssemblyInfo.cs b/src/Tizen.PhonenumberUtils/Properties/AssemblyInfo.cs new file mode 100755 index 0000000..916fbda --- /dev/null +++ b/src/Tizen.PhonenumberUtils/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Tizen.PhonenumberUtils")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Samsung Electronics")] +[assembly: AssemblyProduct("Tizen.PhonenumberUtils")] +[assembly: AssemblyCopyright("Copyright (c) 2016 Samsung Electronics Co., Ltd")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("6b8ec773-abdf-4e51-8158-71c56ce25bb9")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/Tizen.PhonenumberUtils/Tizen.PhonenumberUtils.csproj b/src/Tizen.PhonenumberUtils/Tizen.PhonenumberUtils.csproj new file mode 100644 index 0000000..8d1a6ea --- /dev/null +++ b/src/Tizen.PhonenumberUtils/Tizen.PhonenumberUtils.csproj @@ -0,0 +1,81 @@ + + + + 14.0 + Debug + AnyCPU + 8.0.30703 + 2.0 + {6B8EC773-ABDF-4E51-8158-71C56CE25BB9} + Library + Properties + Tizen.PhonenumberUtils + Tizen.PhonenumberUtils + 512 + en-US + + + .NETStandard + v1.3 + .NETStandard,Version=v1.3 + false + true + $(NoWarn);1701 + false + + + true + portable + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + portable + true + bin\Release\ + TRACE + prompt + 4 + + + true + + + Tizen.PhonenumberUtils.snk + + + + + + + + + + + + + + + + + + + <_TargetFrameworkDirectories>$(MSBuildThisFileDirectory) + <_FullFrameworkReferenceAssemblyPaths>$(MSBuildThisFileDirectory) + true + + \ No newline at end of file diff --git a/src/Tizen.PhonenumberUtils/Tizen.PhonenumberUtils.project.json b/src/Tizen.PhonenumberUtils/Tizen.PhonenumberUtils.project.json new file mode 100644 index 0000000..d2a3aab --- /dev/null +++ b/src/Tizen.PhonenumberUtils/Tizen.PhonenumberUtils.project.json @@ -0,0 +1,9 @@ +{ + "dependencies": { + "NETStandard.Library": "1.6.0", + "Tizen.System": "1.0.8" + }, + "frameworks": { + "netstandard1.3": {} + } +} \ No newline at end of file diff --git a/src/Tizen.PhonenumberUtils/Tizen.PhonenumberUtils.sln b/src/Tizen.PhonenumberUtils/Tizen.PhonenumberUtils.sln new file mode 100755 index 0000000..62d130b --- /dev/null +++ b/src/Tizen.PhonenumberUtils/Tizen.PhonenumberUtils.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.PhonenumberUtils", "Tizen.PhonenumberUtils.csproj", "{6B8EC773-ABDF-4E51-8158-71C56CE25BB9}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6B8EC773-ABDF-4E51-8158-71C56CE25BB9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6B8EC773-ABDF-4E51-8158-71C56CE25BB9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6B8EC773-ABDF-4E51-8158-71C56CE25BB9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6B8EC773-ABDF-4E51-8158-71C56CE25BB9}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.PhonenumberUtils/Tizen.PhonenumberUtils.snk b/src/Tizen.PhonenumberUtils/Tizen.PhonenumberUtils.snk new file mode 100755 index 0000000..2d8e2b6 Binary files /dev/null and b/src/Tizen.PhonenumberUtils/Tizen.PhonenumberUtils.snk differ diff --git a/src/Tizen.PhonenumberUtils/Tizen.PhonenumberUtils/PhonenumberUtils.cs b/src/Tizen.PhonenumberUtils/Tizen.PhonenumberUtils/PhonenumberUtils.cs new file mode 100644 index 0000000..6bf00fb --- /dev/null +++ b/src/Tizen.PhonenumberUtils/Tizen.PhonenumberUtils/PhonenumberUtils.cs @@ -0,0 +1,151 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.PhonenumberUtils +{ + /// + /// This class makes applications can use phonenumber utils. + /// + public class PhonenumberUtils : IDisposable + { + private bool disposed = false; + + public PhonenumberUtils() + { + int ret; + + ret = Interop.PhonenumberUtils.Connect(); + if (ret != (int)PhonenumberUtilsError.None) + { + Log.Error(Globals.LogTag, "Failed to connect, Error - " + (PhonenumberUtilsError)ret); + PhonenumberUtilsErrorFactory.ThrowPhonenumberUtilsException(ret); + } + } + + ~PhonenumberUtils() + { + Dispose(false); + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool disposing) + { + if (disposed) + return; + + if (disposing) + { + // Free managed objects + } + + // Free unmanaged objects + int ret; + + ret = Interop.PhonenumberUtils.Disconnect(); + if (ret != (int)PhonenumberUtilsError.None) + { + Log.Error(Globals.LogTag, "Failed to disconnect, Error - " + (PhonenumberUtilsError)ret); + PhonenumberUtilsErrorFactory.ThrowPhonenumberUtilsException(ret); + } + + disposed = true; + } + + /// + /// Gets the location string from number, region, and language. + /// + /// The number + /// The region of number + /// The language of location + /// The location string + /// Thrown when method failed due to invalid operation + /// Thrown when phonenumber-utils is not supported + /// Thrown when input coordinates are invalid + /// Thrown when failed due to out of memory + public string GetLocationFromNumber(string number, Region region, Language language) + { + int ret; + string result; + + ret = Interop.PhonenumberUtils.GetLocationFromNumber(number, (int)region, (int)language, out result); + if (ret != (int)PhonenumberUtilsError.None) + { + Log.Error(Globals.LogTag, "Failed to get location, Error - " + (PhonenumberUtilsError)ret); + PhonenumberUtilsErrorFactory.ThrowPhonenumberUtilsException(ret); + } + + return result; + } + + /// + /// Gets the formatted number. + /// + /// The number + /// The region of number + /// The formatted number string + /// Thrown when method failed due to invalid operation + /// Thrown when phonenumber-utils is not supported + /// Thrown when input coordinates are invalid + /// Thrown when failed due to out of memory + public string GetFormattedNumber(string number, Region region) + { + int ret; + string result; + + ret = Interop.PhonenumberUtils.GetFormmatedNumber(number, (int)region, out result); + if (ret != (int)PhonenumberUtilsError.None) + { + Log.Error(Globals.LogTag, "Failed to get formatted number, Error - " + (PhonenumberUtilsError)ret); + PhonenumberUtilsErrorFactory.ThrowPhonenumberUtilsException(ret); + } + + return result; + } + + /// + /// Gets the normalized number. + /// + /// http://tizen.org/privilege/telephony + /// The number + /// The normalized number + /// Thrown when method failed due to invalid operation + /// Thrown when phonenumber-utils is not supported + /// Thrown when input coordinates are invalid + /// Thrown when failed due to out of memory + /// Thrown when application does not have proper privileges + public string GetNormalizedNumber(string number) + { + int ret; + string result; + + ret = Interop.PhonenumberUtils.GetNormailizedNumber(number, out result); + if (ret != (int)PhonenumberUtilsError.None) + { + Log.Error(Globals.LogTag, "Failed to get normalized number, Error - " + (PhonenumberUtilsError)ret); + PhonenumberUtilsErrorFactory.ThrowPhonenumberUtilsException(ret); + } + + return result; + } + } +} diff --git a/src/Tizen.PhonenumberUtils/Tizen.PhonenumberUtils/PhonenumberUtilsEnumerations.cs b/src/Tizen.PhonenumberUtils/Tizen.PhonenumberUtils/PhonenumberUtilsEnumerations.cs new file mode 100755 index 0000000..d08c3f5 --- /dev/null +++ b/src/Tizen.PhonenumberUtils/Tizen.PhonenumberUtils/PhonenumberUtilsEnumerations.cs @@ -0,0 +1,1138 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +namespace Tizen.PhonenumberUtils +{ + /// + /// Enumeration for language type. + /// + public enum Language + { + /// + /// Amharic + /// + Amharic, + /// + /// Arabic + /// + Arabic, + /// + /// Belarusian + /// + Belarusian, + /// + /// Bulgarian + /// + Bulgarian, + /// + /// Chinese + /// + Chinese, + /// + /// Chinese(Traditional) + /// + ChineseTranditional, + /// + /// Czech + /// + Czech, + /// + /// Dutch + /// + Dutch, + /// + /// English + /// + English, + /// + /// Finnish + /// + Finnish, + /// + /// French + /// + French, + /// + /// German + /// + German, + /// + /// Greek + /// + Greek, + /// + /// Hungarian + /// + Hungarian, + /// + /// Indonesian + /// + Indonesian, + /// + /// Italian + /// + Italian, + /// + /// Japanese + /// + Japanese, + /// + /// Korean + /// + Korean, + /// + /// Nothern Sami + /// + NorthernSami, + /// + /// Persian + /// + Persian, + /// + /// Polish + /// + Polish, + /// + /// Portuguese + /// + Portuguese, + /// + /// Romanian + /// + Romanian, + /// + /// Russian + /// + Russian, + /// + /// Serbian + /// + Serbian, + /// + /// Spanish + /// + Spanish, + /// + /// Swdish + /// + Swedish, + /// + /// Thai + /// + Thai, + /// + /// Turkish + /// + Turkish, + /// + /// Vietnamese + /// + Vietnamese, + /// + /// Current System Value + /// + System, + Max + } + + /// + /// Enumeration for region type. + /// + public enum Region + { + /// + /// Aland Islands + /// + AlandIslands, + /// + /// Albania + /// + Albania, + /// + /// Algeria + /// + Algeria, + /// + /// American Samoa + /// + AmericanSamoa, + /// + /// Angola + /// + Angola, + /// + /// Anguilla + /// + Anguilla, + /// + /// Argentina + /// + Argentina, + /// + /// Aremenia + /// + Armenia, + /// + /// Ascension Island + /// + AscensionIsland, + /// + /// Atigua and Barbuda + /// + AtiguaAndBarbuda, + /// + /// Autstria + /// + Austria, + /// + /// Bahamas + /// + Bahamas, + /// + /// Barbados + /// + Barbados, + /// + /// Belarus + /// + Belarus, + /// + /// Belgium + /// + Belgium, + /// + /// Benin + /// + Benin, + /// + /// Bermuda + /// + Bermuda, + /// + /// Bonaire, Sint Eustatius and Saba + /// + BonaireSintEustatiusAndSaba, + /// + /// Botswana + /// + Botswana, + /// + /// Brazil + /// + Brazil, + /// + /// Bulgaria + /// + Bulgaria, + /// + /// Burkina Faso + /// + BurkinaFaso, + /// + /// Burundi + /// + Burundi, + /// + /// Cabo Verde + /// + CaboVerde, + /// + /// Cameroon + /// + Cameroon, + /// + /// Canada + /// + Canada, + /// + /// Cayman Island + /// + CaymanIsland, + /// + /// Chile + /// + Chile, + /// + /// China + /// + China, + /// + /// Colombia + /// + Colombia, + /// + /// Comoros + /// + Comoros, + /// + /// Congo + /// + Congo, + /// + /// Cote d'Ivoire + /// + CoteDIvoire, + /// + /// Cuba + /// + Cuba, + /// + /// Curacao + /// + Curacao, + /// + /// Czech Republic + /// + CzechRepublic, + /// + /// Congo (Democratic Republic of the) + /// + DemocraticRepublicOfTheCongo, + /// + /// Dominica + /// + Dominica, + /// + /// Dominican Republic + /// + DominicanRepublic, + /// + /// Egypt + /// + Egypt, + /// + /// Estonia + /// + Estonia, + /// + /// Ethiopia + /// + Ethiopia, + /// + /// Finland + /// + Finland, + /// + /// France + /// + France, + /// + /// Gabon + /// + Gabon, + /// + /// Gambia + /// + Gambia, + /// + /// Germany + /// + Germany, + /// + /// Ghana + /// + Ghana, + /// + /// Greece + /// + Greece, + /// + /// Greenland + /// + Greenland, + /// + /// Grenada + /// + Grenada, + /// + /// Guam + /// + Guam, + /// + /// Guernsey + /// + Guernsey, + /// + /// guinea + /// + Guinea, + /// + /// Guinea-Bissau + /// + GuineaBissau, + /// + /// Hungary + /// + Hungary, + /// + /// Iceland + /// + Iceland, + /// + /// India + /// + India, + /// + /// Indonesia + /// + Indonesia, + /// + /// Ireland + /// + Ireland, + /// + /// Iran (Islamic Republic of) + /// + IslamicRepublicOfIran, + /// + /// Isle of Man + /// + IsleOfMan, + /// + /// Italy + /// + Italy, + /// + /// Jamaica + /// + Jamaica, + /// + /// Japan + /// + Japan, + /// + /// Jersey + /// + Jersey, + /// + /// Jordan + /// + Jordan, + /// + /// Kazakhstan + /// + Kazakhstan, + /// + /// Kenya + /// + Kenya, + /// + /// Kiribati + /// + Kiribati, + /// + /// Latvia + /// + Latvia, + /// + /// Lesotho + /// + Lesotho, + /// + /// Lithuania + /// + Lithuania, + /// + /// Luxembourg + /// + Luxembourg, + /// + /// Madagascar + /// + Madagascar, + /// + /// Mauritania + /// + Mauritania, + /// + /// Mauritius + /// + Mauritius, + /// + /// Monteserrat + /// + Montserrat, + /// + /// Morocco + /// + Morocco, + /// + /// Mozambique + /// + Mozambique, + /// + /// Namibia + /// + Namibia, + /// + /// Netherlands + /// + Netherlands, + /// + /// Nigeria + /// + Nigeria, + /// + /// Northern Mariana Island + /// + NorthernMarianaIslands, + /// + /// Norway + /// + Norway, + /// + /// Peru + /// + Peru, + /// + /// Poland + /// + Poland, + /// + /// Portugal + /// + Portugal, + /// + /// Puerto Rico + /// + PuertoRico, + /// + /// Korea (Republic of) + /// + RepublicOfKorea, + /// + /// Moldova (Republic of) + /// + RepublicOfMoldova, + /// + /// Romania + /// + Romania, + /// + /// Russian Federation + /// + RussianFederation, + /// + /// Saint Helena, Ascension and Tristan da Cunha + /// + SaintHelena, + /// + /// Saint Kitts and Nevis + /// + SaintKittsAndNevis, + /// + /// Saint Lucia + /// + SaintLucia, + /// + /// Saint Vincent and the Grenadines + /// + SaintVicentAndTheGrenadines, + /// + /// Sao Tome and Principe + /// + SaoTomeAndPrincipe, + /// + /// Saudi Arabia + /// + SaudiArabia, + /// + /// Senegal + /// + Senegal, + /// + /// Serbia + /// + Serbia, + /// + /// Sierra Leone + /// + SierraLeone, + /// + /// Sint Maarten (Dutch part) + /// + SintMaarten, + /// + /// Slovakia + /// + Slovakia, + /// + /// Somalia + /// + Somalia, + /// + /// South Africa + /// + SouthAfrica, + /// + /// Spain + /// + Spain, + /// + /// Sri Lanka + /// + SriLanka, + /// + /// Sudan + /// + Sudan, + /// + /// Svalbard and Jan Mayen + /// + SvalbardAndJanMayen, + /// + /// Swaziland + /// + Swaziland, + /// + /// Sweden + /// + Sweden, + /// + /// Switzerland + /// + Switzerland, + /// + /// Taiwan Province of China + /// + TaiwanProvinceOfChina, + /// + /// Thailand + /// + Thailand, + /// + /// Macedonia (the Former Yugoslav Republic of) + /// + TheFormerYugoslavRepublicOfMacedonia, + /// + /// Togo + /// + Togo, + /// + /// Trinidad and Tobago + /// + TrinidadAndTobago, + /// + /// Tristan da Cunha + /// + TristanDaCunha, + /// + /// Tunisia + /// + Tunisia, + /// + /// Turkey + /// + Turkey, + /// + /// Turks and Caicos Islands + /// + TurksAndCaicosIslands, + /// + /// Uganda + /// + Uganda, + /// + /// United Kingdom + /// + UnitedKingdom, + /// + /// United States of America + /// + UnitedStatesOfAmerica, + /// + /// Venezuela + /// + Venezuela, + /// + /// Viet Nam + /// + VietNam, + /// + /// Virgin Island (British) + /// + VirginIslandBritish, + /// + /// Virgin Island (U.S.) + /// + VirginIslandUs, + /// + /// Western Sahara + /// + WesternSahara, + /// + /// Zambia + /// + Zambia, + /// + /// Zimbabwe + /// + Zimbabwe, + /// + /// Andorra + /// + Andorra, + /// + /// United Arab Emirates + /// + UnitedArabEmirates, + /// + /// Afghanistan + /// + Afghanistan, + /// + /// Australia + /// + Australia, + /// + /// Aruba + /// + Aruba, + /// + /// Azerbaijan + /// + Azerbaijan, + /// + /// Bosnia and Herzegovina + /// + BosniaAndHerzegovina, + /// + /// Bangladesh + /// + Bangladesh, + /// + /// Bahrain + /// + Bahrain, + /// + /// Saint Barthelemy, French Antilles + /// + SaintBarthelemy, + /// + /// Brunei Darussalam + /// + BruneiDarussalam, + /// + /// Bolivia + /// + Bolivia, + /// + /// Bhutan + /// + Bhutan, + /// + /// Belize + /// + Belize, + /// + /// Cocos Islands + /// + CocosIslands, + /// + /// Central African Republic + /// + CentralAfricanRepublic, + /// + /// Cook Islands + /// + CookIslands, + /// + /// Costa Rica + /// + CostaRica, + /// + /// Christmas Islands + /// + ChristmasIslands, + /// + /// Cyprus + /// + Cyprus, + /// + /// Djibouti + /// + Djibouti, + /// + /// Denmark + /// + Denmark, + /// + /// Ecuador + /// + Ecuador, + /// + /// Eritrea + /// + Eritrea, + /// + /// Fiji + /// + Fiji, + /// + /// Falkland Islands + /// + FalklandIslands, + /// + /// Micronesia, Federated States of + /// + Micronesia, + /// + /// Faroe Islands + /// + FaroeIslands, + /// + /// Georgia + /// + Georgia, + /// + /// French Guiana + /// + FrenchGuiana, + /// + /// Gibraltar + /// + Gibraltar, + /// + /// Guadeloupe + /// + Guadeloupe, + /// + /// Equatorial Guinea + /// + EquatorialGuinea, + /// + /// Guatemala + /// + Guatemala, + /// + /// Guyana + /// + Guyana, + /// + /// Hong Kong + /// + HongKong, + /// + /// Honduras + /// + Honduras, + /// + /// Croatia + /// + Croatia, + /// + /// Haiti + /// + Haiti, + /// + /// Israel + /// + Israel, + /// + /// British Indian Ocean Territory / Diego Garcia + /// + DiegoGarcia, + /// + /// Iraq + /// + Iraq, + /// + /// Kyrgyzstan + /// + Kyrgyzstan, + /// + /// Cambodia + /// + Cambodia, + /// + /// Korea, Dem. People's Rep. of + /// + NorthKorea, + /// + /// Kuwait + /// + Kuwait, + /// + /// Lao People's Dem. Rep. + /// + Laos, + /// + /// Lebanon + /// + Lebanon, + /// + /// Liechtenstein + /// + Liechtenstein, + /// + /// Liberia + /// + Liberia, + /// + /// Libya (Soc. People's Libyan Arab Jamahiriva) + /// + Libya, + /// + /// Monaco + /// + Monaco, + /// + /// Montenegro + /// + Montenegro, + /// + /// Saint-Martin, French Antilles + /// + SaintMartin, + /// + /// Marshall Islands + /// + MarshallIslands, + /// + /// Mali + /// + Mali, + /// + /// Myanmar + /// + Myanmar, + /// + /// Mongolia + /// + Mongolia, + /// + /// Macao, China + /// + Macao, + /// + /// Martinique (French Dept. of) + /// + Martinique, + /// + /// Malta + /// + Malta, + /// + /// Maldives + /// + Maldives, + /// + /// Malawi + /// + Malawi, + /// + /// Mexico + /// + Mexico, + /// + /// Malaysia + /// + Malaysia, + /// + /// New Caledonia (Territoire francais d'outre-mer) + /// + NewCaledonia, + /// + /// Niger + /// + Niger, + /// + /// Norfolk Island + /// + NorfolkIsland, + /// + /// Nicaragua + /// + Nicaragua, + /// + /// Nepal + /// + Nepal, + /// + /// Naura + /// + Nauru, + /// + /// Niue + /// + Niue, + /// + /// New Zealand + /// + NewZealand, + /// + /// Oman + /// + Oman, + /// + /// Panama + /// + Panama, + /// + /// French Polynesia (Tahiti) (Territoire francais d'outre-mer) + /// + FrenchPolynesia, + /// + /// Papua New Guinea + /// + PapuaNewGuinea, + /// + /// Philippines + /// + Philippines, + /// + /// Pakistan + /// + Pakistan, + /// + /// Saint Pierre and Miquelon (Collectivite territoriale de la Republique francaise) + /// + SaintPierreAndMiquelon, + /// + /// Palestinian Authority + /// + PalestinianAuthority, + /// + /// Palau + /// + Palau, + /// + /// Paraguay + /// + Paraguay, + /// + /// Qatar + /// + Qatar, + /// + /// Reunion (French Departments and Territories in the Indian Ocean) + /// + Reunion, + /// + /// Rwanda + /// + Rwanda, + /// + /// Solomon Islands + /// + SolomonIslands, + /// + /// Seychelles + /// + Seychelles, + /// + /// Singapore + /// + Singapore, + /// + /// Slovenia + /// + Slovenia, + /// + /// San Marino + /// + SanMarino, + /// + /// Suriname + /// + Suriname, + /// + /// South Sudan + /// + SouthSudan, + /// + /// El Salvador + /// + ElSalvadore, + /// + /// Syrian Arab Republic + /// + SyrianArabRepublic, + /// + /// Chad + /// + Chad, + /// + /// Tajikistan + /// + Tajikistan, + /// + /// Tokelau + /// + Tokelau, + /// + /// Timor-Leste (East Timor) + /// + TimorLeste, + /// + /// Turkmenistan + /// + Turkmenistan, + /// + /// Tonga + /// + Tonga, + /// + /// Tuvalu + /// + Tuvalu, + /// + /// Tanzania + /// + Tanzania, + /// + /// Ukraine + /// + Ukraine, + /// + /// Uruguay + /// + Uruguay, + /// + /// Uzbekistan + /// + Uzbekistan, + /// + /// Vatican City + /// + VaticanCity, + /// + /// Vanuatu + /// + Vanuatu, + /// + /// Wallis and Futuna (Territoire francais d'outre-mer) + /// + WallisAndFutuna, + /// + /// Samoa + /// + Samoa, + /// + /// Yemen + /// + Yemen, + /// + /// Mayotte + /// + Mayotte, + /// + /// Current System Value + /// + System, + Max + } +} diff --git a/src/Tizen.PhonenumberUtils/Tizen.PhonenumberUtils/PhonenumberUtilsErrorFactory.cs b/src/Tizen.PhonenumberUtils/Tizen.PhonenumberUtils/PhonenumberUtilsErrorFactory.cs new file mode 100644 index 0000000..afac3ef --- /dev/null +++ b/src/Tizen.PhonenumberUtils/Tizen.PhonenumberUtils/PhonenumberUtilsErrorFactory.cs @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using Tizen.Internals.Errors; + +namespace Tizen.PhonenumberUtils +{ + internal enum PhonenumberUtilsError + { + None = ErrorCode.None, + IoError = ErrorCode.IoError, + OutOfMemory = ErrorCode.OutOfMemory, + InvalidParameter = ErrorCode.InvalidParameter, + FileNoSpaceOnDevice = ErrorCode.FileNoSpaceOnDevice, + PermissionDenied = ErrorCode.PermissionDenied, + NotSupported = ErrorCode.NotSupported, + NoData = ErrorCode.NoData, + System = -0x02020000 | 0xEF, + } + + static internal class Globals + { + internal const string LogTag = "Tizen.PhonenumberUtils"; + } + + internal static class PhonenumberUtilsErrorFactory + { + static internal void ThrowPhonenumberUtilsException(int e) + { + PhonenumberUtilsError err = (PhonenumberUtilsError)e; + + switch (err) + { + case PhonenumberUtilsError.InvalidParameter: + throw new ArgumentException(err.ToString()); + case PhonenumberUtilsError.NotSupported: + throw new NotSupportedException(err.ToString()); + case PhonenumberUtilsError.PermissionDenied: + throw new UnauthorizedAccessException(err.ToString()); + case PhonenumberUtilsError.OutOfMemory: + throw new OutOfMemoryException(err.ToString()); + default: + throw new InvalidOperationException(err.ToString()); + } + } + } +}