summaryrefslogtreecommitdiff
path: root/mobile_src/Contact/ContactConverter.h
diff options
context:
space:
mode:
Diffstat (limited to 'mobile_src/Contact/ContactConverter.h')
-rw-r--r--mobile_src/Contact/ContactConverter.h195
1 files changed, 195 insertions, 0 deletions
diff --git a/mobile_src/Contact/ContactConverter.h b/mobile_src/Contact/ContactConverter.h
new file mode 100644
index 0000000..e96b6dd
--- /dev/null
+++ b/mobile_src/Contact/ContactConverter.h
@@ -0,0 +1,195 @@
+//
+// Tizen Web Device API
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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.
+//
+
+/**
+ * @file ContactConverter.cpp
+ * @version 0.1
+ * @brief
+ */
+
+#ifndef _TIZEN_JS_CONTACT_CONVERTER_H_
+#define _TIZEN_JS_CONTACT_CONVERTER_H_
+
+#include <JavaScriptCore/JavaScript.h>
+#include <CommonsJavaScript/Converter.h>
+#include "ContactTypes.h"
+#include "IAddressBook.h"
+#include "IContact.h"
+#include "IPerson.h"
+#include "ContactGroup.h"
+#include "ContactRef.h"
+#include "ContactName.h"
+#include "ContactOrganization.h"
+#include "ContactWebSite.h"
+#include "ContactAnniversary.h"
+#include "ContactAddress.h"
+#include "ContactPhoneNumber.h"
+#include "ContactEmailAddress.h"
+#include <ArgumentValidator.h>
+#include <JSWebAPIErrorFactory.h>
+#include <Security.h>
+#include <JSUtil.h>
+#include <Export.h>
+
+namespace DeviceAPI {
+namespace Contact {
+
+class DLL_EXPORT ContactConverter : public WrtDeviceApis::CommonsJavaScript::Converter
+{
+public:
+ using WrtDeviceApis::CommonsJavaScript::Converter::toJSValueRef;
+
+ explicit ContactConverter(JSContextRef context);
+ virtual ~ContactConverter();
+
+ JSValueRef toJSValueRef(const AddressBookPtr &arg, const DeviceAPI::Common::SecurityAccessor *securityAccessor);
+ AddressBookPtr toAddressBook(const JSValueRef &jsValue);
+
+ JSValueRef toJSValueRef(const AddressBookArrayPtr &arg, const DeviceAPI::Common::SecurityAccessor *securityAccessor);
+ AddressBookArrayPtr toAddressBookArray(const JSValueRef &jsValue);
+
+ JSValueRef toJSValueRef(const ContactPtr &arg);
+ ContactPtr toContact(const JSValueRef &jsValue);
+ ContactPtr toContactFromInit(const JSValueRef &jsValue);
+
+ JSValueRef toJSValueRef(const ContactArrayPtr &arg);
+ ContactArrayPtr toContactArray(const JSValueRef &jsValue);
+
+ JSValueRef toJSValueRef(const ContactGroupPtr &arg);
+ ContactGroupPtr toContactGroup(const JSValueRef &jsValue);
+
+ JSValueRef toJSValueRef(const ContactGroupArrayPtr &arg);
+ ContactGroupArrayPtr toContactGroupArray(const JSValueRef &jsValue);
+
+ JSValueRef toJSValueRef(const PersonPtr &arg, const DeviceAPI::Common::SecurityAccessor *securityAccessor);
+ PersonPtr toPerson(const JSValueRef &jsValue);
+
+ JSValueRef toJSValueRef(const PersonArrayPtr &arg, const DeviceAPI::Common::SecurityAccessor *securityAccessor);
+ PersonArrayPtr toPersonArray(const JSValueRef &jsValue);
+
+ JSValueRef toJSValueRef(const ContactRefPtr &arg);
+ ContactRefPtr toContactRef(const JSValueRef &jsValue);
+
+ JSValueRef toJSValueRef(const ContactNamePtr &arg);
+ ContactNamePtr toContactName(const JSValueRef &jsValue);
+ ContactNamePtr toContactNameFromInit(const JSValueRef &jsValue);
+
+ JSValueRef toJSValueRef(const ContactOrganizationPtr &arg);
+ ContactOrganizationPtr toContactOrganization(const JSValueRef &jsValue);
+ ContactOrganizationPtr toContactOrganizationFromInit(const JSValueRef &jsValue);
+
+ JSValueRef toJSValueRef(const ContactOrganizationArrayPtr &arg);
+ ContactOrganizationArrayPtr toContactOrganizationArray(const JSValueRef &jsValue);
+
+ JSValueRef toJSValueRef(const ContactWebSitePtr &arg);
+ ContactWebSitePtr toContactWebSite(const JSValueRef &jsValue);
+
+ JSValueRef toJSValueRef(const ContactWebSiteArrayPtr &arg);
+ ContactWebSiteArrayPtr toContactWebSiteArray(const JSValueRef &jsValue);
+
+ JSValueRef toJSValueRef(const ContactAnniversaryPtr &arg);
+ ContactAnniversaryPtr toContactAnniversary(const JSValueRef &jsValue);
+
+ JSValueRef toJSValueRef(const ContactAnniversaryArrayPtr &arg);
+ ContactAnniversaryArrayPtr toContactAnniversaryArray(const JSValueRef &jsValue);
+
+ JSValueRef toJSValueRef(const ContactAddressPtr &arg);
+ ContactAddressPtr toContactAddress(const JSValueRef &jsValue);
+ ContactAddressPtr toContactAddressFromInit(const JSValueRef &jsValue);
+
+ JSValueRef toJSValueRef(const ContactAddressArrayPtr &arg);
+ ContactAddressArrayPtr toContactAddressArray(const JSValueRef &jsValue);
+
+ JSValueRef toJSValueRef(const ContactPhoneNumberPtr &arg);
+ ContactPhoneNumberPtr toContactPhoneNumber(const JSValueRef &jsValue);
+
+ JSValueRef toJSValueRef(const ContactPhoneNumberArrayPtr &arg);
+ ContactPhoneNumberArrayPtr toContactPhoneNumberArray(const JSValueRef &jsValue);
+
+ JSValueRef toJSValueRef(const ContactEmailAddressPtr &arg);
+ ContactEmailAddressPtr toContactEmailAddress(const JSValueRef &jsValue);
+
+ JSValueRef toJSValueRef(const ContactEmailAddressArrayPtr &arg);
+ ContactEmailAddressArrayPtr toContactEmailAddressArray(const JSValueRef &jsValue);
+
+ // ContactWebSiteType
+ ContactWebSiteType toContactWebSiteType(const std::string &arg);
+ std::string toContactWebSiteTypeStr(ContactWebSiteType arg);
+ ContactWebSiteType toContactWebSiteType(const JSValueRef &value);
+ JSValueRef toJSValueRef(ContactWebSiteType arg);
+
+ // ContactOrganizationType
+ ContactOrganizationType toContactOrganizationType(const std::string &arg);
+ std::string toContactOrganizationTypeStr(ContactOrganizationType arg);
+ ContactOrganizationType toContactOrganizationType(const JSValueRef &value);
+ JSValueRef toJSValueRef(ContactOrganizationType arg);
+
+ // ContactAddressType
+ ContactAddressType toContactAddressType(const std::string &arg);
+ std::string toContactAddressTypeStr(ContactAddressType arg);
+ ContactAddressType toContactAddressType(const JSValueRef &value);
+ JSValueRef toJSValueRef(ContactAddressType arg);
+
+ // ContactAddressType Array
+ JSValueRef toJSValueRef(const ContactAddressTypeArrayPtr &arg);
+ ContactAddressTypeArrayPtr toContactAddressTypeArray(const JSValueRef &jsValue);
+
+ // ContactPhoneNumberType
+ ContactPhoneNumberType toContactPhoneNumberType(const std::string &arg);
+ std::string toContactPhoneNumberTypeStr(ContactPhoneNumberType arg);
+ ContactPhoneNumberType toContactPhoneNumberType(const JSValueRef &value);
+ JSValueRef toJSValueRef(ContactPhoneNumberType arg);
+
+ // ContactPhoneNumberType Array
+ JSValueRef toJSValueRef(const ContactPhoneNumberTypeArrayPtr &arg);
+ ContactPhoneNumberTypeArrayPtr toContactPhoneNumberTypeArray(const JSValueRef &jsValue);
+
+ // ContactEmailAddressType
+ ContactEmailAddressType toContactEmailAddressType(const std::string &arg);
+ std::string toContactEmailAddressTypeStr(ContactEmailAddressType arg);
+ ContactEmailAddressType toContactEmailAddressType(const JSValueRef &value);
+ JSValueRef toJSValueRef(ContactEmailAddressType arg);
+
+ // ContactEmailAddressType Array
+ JSValueRef toJSValueRef(const ContactEmailAddressTypeArrayPtr &arg);
+ ContactEmailAddressTypeArrayPtr toContactEmailAddressTypeArray(const JSValueRef &jsValue);
+
+ // String Array
+ StringArrayPtr toStringArray(const JSValueRef &value);
+ JSValueRef toJSValueRef(const StringArrayPtr &arg);
+
+ // AttributesOfInterest Array - No more used
+// JSValueRef toJSValueRefAttributesOfInterestArray(const AttributesOfInterestArrayPtr &arg);
+// AttributesOfInterestArrayPtr toAttributesOfInterestArray(const JSValueRef &jsValue);
+
+// JSValueRef toJSValueRef(const std::string &arg);
+// std::string toAttributesOfInterest(const JSValueRef &value);
+
+private:
+ bool initializeAllowedProperties();
+ static std::vector<std::string> m_allowedContactInit;
+ static std::vector<std::string> m_allowedContactNameInit;
+ static std::vector<std::string> m_allowedContactOrganizationInit;
+ static std::vector<std::string> m_allowedContactAddressInit;
+};
+
+typedef WrtDeviceApis::CommonsJavaScript::ConverterFactory<ContactConverter> ContactConverterFactory;
+
+} // Contact
+} // DeviceAPI
+
+#endif // _TIZEN_JS_CONTACT_CONVERTER_H_