Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Unified Diff: utilities.h

Issue 6612044: Added an SmsMessage class, and code for parsing a PDU to an SMS message. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/cromo.git@master
Patch Set: Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sms_message_unittest.cc ('k') | utilities.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utilities.h
diff --git a/utilities.h b/utilities.h
index da1c85eb955bb7860c154c286e65af8fb5ecce8b..cbec00990cdeb0282e06d5408999968b2da23556 100644
--- a/utilities.h
+++ b/utilities.h
@@ -18,30 +18,50 @@ namespace utilities {
typedef std::map<std::string, DBus::Variant> DBusPropertyMap;
-// Extracts the key from proprties, returning not_found_response if
+// Extracts the key from properties, returning not_found_response if
// the key is not found. If key is found, but is not a string, sets
// error and returns not_found_response. If error.is_set() is true,
// ExtractString will not report further errors. You can make
// multiple ExtractString calls and check error at the end.
-const char *ExtractString(const DBusPropertyMap properties,
- const char *key,
- const char *not_found_response,
- DBus::Error &error);
+const char* ExtractString(const DBusPropertyMap properties,
+ const char* key,
+ const char* not_found_response,
+ DBus::Error& error);
-// Extracts the key from proprties, returning not_found_response if
+// Extracts the key from properties, returning not_found_response if
// the key is not found. If key is found, but is not a Uint32, sets
// error and returns not_found_response. If error.is_set() is true,
// ExtractUint32 will not report further errors. You can make
// multiple ExtractUint32 calls and check error at the end.
uint32_t ExtractUint32(const DBusPropertyMap properties,
- const char *key,
+ const char* key,
uint32_t not_found_response,
- DBus::Error &error);
+ DBus::Error& error);
// Convert a string representing a hex ESN to one representing a
// decimal ESN. Returns success.
-bool HexEsnToDecimal(const std::string &esn_hex, std::string *out);
+bool HexEsnToDecimal(const std::string& esn_hex, std::string* out);
+
+// Converts an array of bytes containing text encoded in the GSM 03.38
+// character set (also know as GSM-7) into a UTF-8 encoded string.
+// GSM-7 is a 7-bit character set, and in SMS messages, the 7-bit
+// septets are packed into an array of 8-bit octets.
+//
+// The first byte of the input array the length of the converted
+// data in septets, i.e., it is the number of GSM-7 septets that
+// will result after the array is unpacked.
+std::string Gsm7ToUtf8String(const uint8_t* gsm7);
+
+// Converts a string of characters encoded using UTF-8 into an
+// array of bytes which is result of converting the string into
+// septets in the GSM-7 alphabet and then packing the septets into
+// octets.
+std::vector<uint8_t> Utf8StringToGsm7(const std::string& input);
+
+// Debugging utility for printing an array of bytes in a nicely
+// formatted manner รก la the UNIX hd command.
+void DumpHex(const uint8_t* buf, size_t size);
} // namespace utilities
« no previous file with comments | « sms_message_unittest.cc ('k') | utilities.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698