[contact] Google code style
authorRyszard Matuszyk <r.matuszyk@samsung.com>
Wed, 25 Feb 2015 11:11:04 +0000 (12:11 +0100)
committerRyszard Matuszyk <r.matuszyk@samsung.com>
Wed, 25 Feb 2015 11:12:05 +0000 (12:12 +0100)
Verification] TCT test should pass: 438/438

Change-Id: I1264b699bc8d85027f847effe70d2c9a713e5fe7
Signed-off-by: Ryszard Matuszyk <r.matuszyk@samsung.com>
src/contact/addressbook.cc
src/contact/contact_extension.cc
src/contact/contact_instance.cc
src/contact/contact_manager.cc
src/contact/contact_util.cc
src/contact/person.cc

index 2799b5a..4618f43 100644 (file)
@@ -181,8 +181,7 @@ PlatformResult AddressBookUpdate(const JsonObject& args, JsonObject& out) {
     }
   }
 
-  status =
-      ContactUtil::UpdateAdditionalInformation(contacts_record_ptr, &out);
+  status = ContactUtil::UpdateAdditionalInformation(contacts_record_ptr, &out);
   if (status.IsError()) return status;
 
   return PlatformResult(ErrorCode::NO_ERROR);
index 1a93572..c1551b4 100644 (file)
@@ -7,31 +7,21 @@
 
 extern const char kSource_contact_api[];
 
-common::Extension* CreateExtension() {
-  return new ContactExtension;
-}
+common::Extension* CreateExtension() { return new ContactExtension; }
 
 ContactExtension::ContactExtension() {
   SetExtensionName("tizen.contact");
   SetJavaScriptAPI(kSource_contact_api);
 
   const char* entry_points[] = {
-      "tizen.ContactRef",
-      "tizen.ContactName",
-      "tizen.ContactOrganization",
-      "tizen.ContactWebSite",
-      "tizen.ContactAnniversary",
-      "tizen.ContactAddress",
-      "tizen.ContactPhoneNumber",
-      "tizen.ContactEmailAddress",
-      "tizen.ContactGroup",
-      "tizen.ContactRelationship",
-      "tizen.ContactInstantMessenger",
-      "tizen.Contact",
-      "tizen.AddressBook",
-      NULL
-    };
-    SetExtraJSEntryPoints(entry_points);
+      "tizen.ContactRef",              "tizen.ContactName",
+      "tizen.ContactOrganization",     "tizen.ContactWebSite",
+      "tizen.ContactAnniversary",      "tizen.ContactAddress",
+      "tizen.ContactPhoneNumber",      "tizen.ContactEmailAddress",
+      "tizen.ContactGroup",            "tizen.ContactRelationship",
+      "tizen.ContactInstantMessenger", "tizen.Contact",
+      "tizen.AddressBook",             NULL};
+  SetExtraJSEntryPoints(entry_points);
 }
 
 ContactExtension::~ContactExtension() {}
index 2d2d2cd..7d42ba7 100644 (file)
@@ -115,8 +115,8 @@ void ContactInstance::AddressBookAddBatch(const JsonValue& args,
       ReportError(status, &response->get<JsonObject>());
   };
 
-  auto get_response = [this, callback_id](
-      const std::shared_ptr<JsonValue>& response) {
+  auto get_response =
+      [this, callback_id](const std::shared_ptr<JsonValue>& response) {
     JsonObject& obj = response->get<JsonObject>();
     obj.insert(std::make_pair("callbackId", callback_id));
     PostMessage(response->serialize().c_str());
@@ -229,8 +229,8 @@ void ContactInstance::AddressBookFind(const JsonValue& args, JsonObject& out) {
       ReportError(status, &response->get<JsonObject>());
   };
 
-  auto get_response = [this, callback_id](
-      const std::shared_ptr<JsonValue>& response) {
+  auto get_response =
+      [this, callback_id](const std::shared_ptr<JsonValue>& response) {
     JsonObject& obj = response->get<JsonObject>();
     obj.insert(std::make_pair("callbackId", callback_id));
     PostMessage(response->serialize().c_str());
index 3d52e49..72a90c5 100644 (file)
@@ -84,8 +84,8 @@ PlatformResult ContactManagerGetAddressBooks(const JsonObject& args,
     int account_id = 0;
     int mode = 0;
     char* name = nullptr;
-    status = ContactUtil::GetIntFromRecord(
-        contacts_record, _contacts_address_book.id, &id);
+    status = ContactUtil::GetIntFromRecord(contacts_record,
+                                           _contacts_address_book.id, &id);
     if (status.IsError()) return status;
 
     status = ContactUtil::GetIntFromRecord(
@@ -121,7 +121,8 @@ PlatformResult ContactManagerGetAddressBook(const JsonObject& args,
   PlatformResult status = ContactUtil::CheckDBConnection();
   if (status.IsError()) return status;
 
-  long address_book_id = common::stol(FromJson<JsonString>(args, "addressBookId"));
+  long address_book_id =
+      common::stol(FromJson<JsonString>(args, "addressBookId"));
 
   contacts_record_h contacts_record;
   int error_code = contacts_db_get_record(_contacts_address_book._uri,
@@ -368,7 +369,7 @@ PlatformResult ContactManagerFind(const JsonObject& args, JsonArray& out) {
         error_code = contacts_filter_add_bool(contacts_filter,
                                               property.propertyId, value);
         status = ContactUtil::ErrorChecker(error_code,
-                                  "Failed contacts_filter_add_bool");
+                                           "Failed contacts_filter_add_bool");
         if (status.IsError()) return status;
       } else if (property.type == kPrimitiveTypeString) {
         std::string value = JsonCast<std::string>(match_value);
@@ -428,8 +429,8 @@ PlatformResult ContactManagerFind(const JsonObject& args, JsonArray& out) {
         return PlatformResult(ErrorCode::UNKNOWN_ERR,
                               "Invalid primitive type!");
       }
-      intermediate_filters[intermediate_filters.size() - 1]
-          .push_back(std::move(contacts_filter_ptr));
+      intermediate_filters[intermediate_filters.size() - 1].push_back(
+          std::move(contacts_filter_ptr));
 
       return PlatformResult(ErrorCode::NO_ERROR);
     });
@@ -469,24 +470,24 @@ PlatformResult ContactManagerFind(const JsonObject& args, JsonArray& out) {
           if (initial_value_bool == end_value_bool) {
             error_code = contacts_filter_add_bool(
                 contacts_filter, property.propertyId, initial_value_bool);
-            status = ContactUtil::ErrorChecker(error_code,
-                                      "Failed contacts_filter_add_bool");
+            status = ContactUtil::ErrorChecker(
+                error_code, "Failed contacts_filter_add_bool");
             if (status.IsError()) return status;
           }
         } else if (initial_value_exists) {
           if (initial_value_bool) {
             error_code = contacts_filter_add_bool(contacts_filter,
                                                   property.propertyId, true);
-            status = ContactUtil::ErrorChecker(error_code,
-                                      "Failed contacts_filter_add_bool");
+            status = ContactUtil::ErrorChecker(
+                error_code, "Failed contacts_filter_add_bool");
             if (status.IsError()) return status;
           }
         } else if (end_value_exists) {
           if (!end_value_bool) {
             error_code = contacts_filter_add_bool(contacts_filter,
                                                   property.propertyId, false);
-            status = ContactUtil::ErrorChecker(error_code,
-                                      "Failed contacts_filter_add_bool");
+            status = ContactUtil::ErrorChecker(
+                error_code, "Failed contacts_filter_add_bool");
             if (status.IsError()) return status;
           }
         }
@@ -508,7 +509,7 @@ PlatformResult ContactManagerFind(const JsonObject& args, JsonArray& out) {
           error_code =
               contacts_filter_create(_contacts_person._uri, &sub_filter);
           status = ContactUtil::ErrorChecker(error_code,
-                                    "Failed contacts_filter_add_str");
+                                             "Failed contacts_filter_add_str");
           if (status.IsError()) return status;
 
           ContactUtil::ContactsFilterPtr sub_filter_ptr(
@@ -518,44 +519,43 @@ PlatformResult ContactManagerFind(const JsonObject& args, JsonArray& out) {
                                                CONTACTS_MATCH_STARTSWITH,
                                                initial_value_str.c_str());
           status = ContactUtil::ErrorChecker(error_code,
-                                    "Failed contacts_filter_add_str");
+                                             "Failed contacts_filter_add_str");
           if (status.IsError()) return status;
 
           error_code = contacts_filter_add_operator(
               sub_filter, CONTACTS_FILTER_OPERATOR_AND);
           status = ContactUtil::ErrorChecker(error_code,
-                                    "Failed contacts_filter_add_str");
+                                             "Failed contacts_filter_add_str");
           if (status.IsError()) return status;
 
           error_code = contacts_filter_add_str(sub_filter, property.propertyId,
                                                CONTACTS_MATCH_ENDSWITH,
                                                end_value_str.c_str());
           status = ContactUtil::ErrorChecker(error_code,
-                                    "Failed contacts_filter_add_str");
+                                             "Failed contacts_filter_add_str");
           if (status.IsError()) return status;
 
           error_code = contacts_filter_add_filter(contacts_filter, sub_filter);
           status = ContactUtil::ErrorChecker(error_code,
-                                    "Failed contacts_filter_add_str");
+                                             "Failed contacts_filter_add_str");
           if (status.IsError()) return status;
         } else if (initial_value_exists) {
           error_code = contacts_filter_add_str(
               contacts_filter, property.propertyId, CONTACTS_MATCH_STARTSWITH,
               initial_value_str.c_str());
           status = ContactUtil::ErrorChecker(error_code,
-                                    "Failed contacts_filter_add_str");
+                                             "Failed contacts_filter_add_str");
           if (status.IsError()) return status;
         } else if (end_value_exists) {
           error_code = contacts_filter_add_str(
               contacts_filter, property.propertyId, CONTACTS_MATCH_ENDSWITH,
               end_value_str.c_str());
           status = ContactUtil::ErrorChecker(error_code,
-                                    "Failed contacts_filter_add_str");
+                                             "Failed contacts_filter_add_str");
           if (status.IsError()) return status;
         }
       } else if (property.type == kPrimitiveTypeLong ||
                  property.type == kPrimitiveTypeId) {
-
         int initial_value_int = 0;
         int end_value_int = 0;
 
@@ -583,7 +583,7 @@ PlatformResult ContactManagerFind(const JsonObject& args, JsonArray& out) {
           error_code =
               contacts_filter_create(_contacts_person._uri, &sub_filter);
           status = ContactUtil::ErrorChecker(error_code,
-                                    "Failed contacts_filter_add_bool");
+                                             "Failed contacts_filter_add_bool");
           if (status.IsError()) return status;
 
           ContactUtil::ContactsFilterPtr sub_filter_ptr(
@@ -593,47 +593,47 @@ PlatformResult ContactManagerFind(const JsonObject& args, JsonArray& out) {
               sub_filter, property.propertyId,
               CONTACTS_MATCH_GREATER_THAN_OR_EQUAL, initial_value_int);
           status = ContactUtil::ErrorChecker(error_code,
-                                    "Failed contacts_filter_add_int");
+                                             "Failed contacts_filter_add_int");
           if (status.IsError()) return status;
 
           error_code = contacts_filter_add_operator(
               sub_filter, CONTACTS_FILTER_OPERATOR_AND);
-          status = ContactUtil::ErrorChecker(error_code,
-                                    "Failed contacts_filter_add_operator");
+          status = ContactUtil::ErrorChecker(
+              error_code, "Failed contacts_filter_add_operator");
           if (status.IsError()) return status;
 
           error_code = contacts_filter_add_int(
               sub_filter, property.propertyId,
               CONTACTS_MATCH_LESS_THAN_OR_EQUAL, end_value_int);
           status = ContactUtil::ErrorChecker(error_code,
-                                    "Failed contacts_filter_add_int");
+                                             "Failed contacts_filter_add_int");
           if (status.IsError()) return status;
 
           error_code = contacts_filter_add_filter(contacts_filter, sub_filter);
-          status = ContactUtil::ErrorChecker(error_code,
-                                    "Failed contacts_filter_add_filter");
+          status = ContactUtil::ErrorChecker(
+              error_code, "Failed contacts_filter_add_filter");
           if (status.IsError()) return status;
         } else if (initial_value_exists) {
           error_code = contacts_filter_add_int(
               contacts_filter, property.propertyId,
               CONTACTS_MATCH_GREATER_THAN_OR_EQUAL, initial_value_int);
           status = ContactUtil::ErrorChecker(error_code,
-                                    "Failed contacts_filter_add_int");
+                                             "Failed contacts_filter_add_int");
           if (status.IsError()) return status;
         } else if (end_value_exists) {
           error_code = contacts_filter_add_int(
               contacts_filter, property.propertyId,
               CONTACTS_MATCH_LESS_THAN_OR_EQUAL, end_value_int);
           status = ContactUtil::ErrorChecker(error_code,
-                                    "Failed contacts_filter_add_int");
+                                             "Failed contacts_filter_add_int");
           if (status.IsError()) return status;
         }
       } else {
         return PlatformResult(ErrorCode::UNKNOWN_ERR,
                               "Invalid primitive type!");
       }
-      intermediate_filters[intermediate_filters.size() - 1]
-          .push_back(std::move(contacts_filter_ptr));
+      intermediate_filters[intermediate_filters.size() - 1].push_back(
+          std::move(contacts_filter_ptr));
 
       return PlatformResult(ErrorCode::NO_ERROR);
     });
@@ -665,20 +665,20 @@ PlatformResult ContactManagerFind(const JsonObject& args, JsonArray& out) {
         error_code = contacts_filter_add_filter(
             merged_filter, intermediate_filters.back().at(i).get());
         status = ContactUtil::ErrorChecker(error_code,
-                                  "Failed contacts_query_set_filter");
+                                           "Failed contacts_query_set_filter");
         if (status.IsError()) return status;
 
         if (CompositeFilterType::kIntersection == type) {
           error_code = contacts_filter_add_operator(
               merged_filter, CONTACTS_FILTER_OPERATOR_AND);
-          status = ContactUtil::ErrorChecker(error_code,
-                                    "Failed contacts_query_set_filter");
+          status = ContactUtil::ErrorChecker(
+              error_code, "Failed contacts_query_set_filter");
           if (status.IsError()) return status;
         } else if (CompositeFilterType::kUnion == type) {
           error_code = contacts_filter_add_operator(
               merged_filter, CONTACTS_FILTER_OPERATOR_OR);
-          status = ContactUtil::ErrorChecker(error_code,
-                                    "Failed contacts_query_set_filter");
+          status = ContactUtil::ErrorChecker(
+              error_code, "Failed contacts_query_set_filter");
           if (status.IsError()) return status;
         } else {
           return PlatformResult(ErrorCode::INVALID_VALUES_ERR,
@@ -713,8 +713,8 @@ PlatformResult ContactManagerFind(const JsonObject& args, JsonArray& out) {
   error_code =
       contacts_db_get_records_with_query(contacts_query, 0, 0, &person_list);
 
-  status = ContactUtil::ErrorChecker(error_code,
-                            "Failed contacts_db_get_records_with_query");
+  status = ContactUtil::ErrorChecker(
+      error_code, "Failed contacts_db_get_records_with_query");
   if (status.IsError()) return status;
 
   ContactUtil::ContactsListHPtr person_list_ptr(
index 54409fc..d8752f1 100644 (file)
@@ -658,7 +658,8 @@ PlatformResult ImportContactPhoneNumberFromContactsRecord(
     JsonObject* out_ptr) {
   JsonObject& out = *out_ptr;
   contacts_record_h child_record = nullptr;
-  // contacts_record is protected by unique_ptr and its ownership is not passed here
+  // contacts_record is protected by unique_ptr and its ownership is not passed
+  // here
   if (!contacts_record) {
     LoggerE("Contacts record is null");
     return PlatformResult(ErrorCode::UNKNOWN_ERR, "Contacts record is null");
@@ -755,7 +756,8 @@ PlatformResult ImportContactPhoneNumberFromContactsRecord(
 PlatformResult ExportContactPhoneNumberToContactsRecord(
     contacts_record_h contacts_record, const JsonObject& in) {
   contacts_record_h phone_record = nullptr;
-  // contacts_record is protected by unique_ptr and its ownership is not passed here
+  // contacts_record is protected by unique_ptr and its ownership is not passed
+  // here
   if (!contacts_record) {
     LoggerE("Contacts record is null");
     return PlatformResult(ErrorCode::UNKNOWN_ERR, "Contacts record is null");
@@ -945,8 +947,8 @@ PlatformResult ExportContactOrganizationToContactsRecord(
   if (!IsNull(in, "logoURI")) {
     std::string path =
         ContactUtil::ConvertUriToPath(FromJson<JsonString>(in, "logoURI"));
-    status = ContactUtil::SetStrInRecord(
-        organization_record, _contacts_company.logo, path.c_str());
+    status = ContactUtil::SetStrInRecord(organization_record,
+                                         _contacts_company.logo, path.c_str());
     if (status.IsError()) return status;
   }
 
@@ -1829,7 +1831,8 @@ PlatformResult ImportContactFromContactsRecord(
     out.insert(std::make_pair("name", JsonValue{}));
   }
 
-  typedef PlatformResult (*ImportFunc)(contacts_record_h, unsigned int, JsonObject*);
+  typedef PlatformResult (*ImportFunc)(contacts_record_h, unsigned int,
+                                       JsonObject*);
   struct ImportData {
     const char* name;
     unsigned int property_id;
@@ -1848,7 +1851,8 @@ PlatformResult ImportContactFromContactsRecord(
       {"messengers", _contacts_contact.messenger,
        ImportContactInstantMessengerFromContactsRecord},
       {"relationships", _contacts_contact.relationship,
-       ImportContactRelationshipFromContactsRecord}, };
+       ImportContactRelationshipFromContactsRecord},
+  };
 
   for (auto& data : imports) {
     JsonArray& array = out.insert(std::make_pair(data.name, JsonArray()))
@@ -1981,7 +1985,8 @@ PlatformResult ExportContactToContactsRecord(contacts_record_h contacts_record,
       {_contacts_contact.messenger, "messengers",
        ExportContactInstantMessengerToContactsRecord},
       {_contacts_contact.relationship, "relationships",
-       ExportContactRelationshipToContactsRecord}, };
+       ExportContactRelationshipToContactsRecord},
+  };
 
   for (auto& data : exports) {
     PlatformResult status =
@@ -2298,8 +2303,8 @@ PlatformResult ExportPersonToContactsRecord(contacts_record_h record,
         record, _contacts_person.image_thumbnail_path,
         FromJson<JsonString>(args, "photoURI").c_str());
     if (status.IsError()) {
-        LoggerE("Try updating read only attribute photoURI");
-        return status;
+      LoggerE("Try updating read only attribute photoURI");
+      return status;
     }
   } else {
     // TO DO: fix when photoURI attribute changed from read only to write mode
index 8c224f3..d4eab34 100644 (file)
@@ -36,7 +36,8 @@ static const PersonPropertyMap personPropertyMap = {
     {"photoURI", {_contacts_person.image_thumbnail_path, kPrimitiveTypeString}},
     {"ringtoneURI", {_contacts_person.ringtone_path, kPrimitiveTypeString}},
     {"displayContactId",
-     {_contacts_person.display_contact_id, kPrimitiveTypeId}}, };
+     {_contacts_person.display_contact_id, kPrimitiveTypeId}},
+};
 
 PlatformResult PersonLink(const JsonObject& args, JsonObject&) {
   PlatformResult status = ContactUtil::CheckDBConnection();
@@ -127,7 +128,7 @@ PlatformResult PersonUnlink(const JsonObject& args, JsonObject& out) {
 }
 
 PlatformResult PersonPropertyFromString(const std::string& name,
-                                        PersonProperty *person_prop) {
+                                        PersonPropertyperson_prop) {
   auto iter = personPropertyMap.find(name);
   if (iter == personPropertyMap.end()) {
     LoggerE("Invalid property name (not in map): %s", name.c_str());