aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/imap/MCIMAPIdentity.cpp
diff options
context:
space:
mode:
authorGravatar Hoa V. DINH <dinh.viet.hoa@gmail.com>2014-11-19 00:48:34 -0800
committerGravatar Hoa V. DINH <dinh.viet.hoa@gmail.com>2014-11-19 00:48:34 -0800
commite3c45123799d84b0ff85035db606cc36b8379427 (patch)
tree17b16bd16f57d097eae1458e8fa10943fb75e54c /src/core/imap/MCIMAPIdentity.cpp
parentb030d6139ba3f0eb39818ce6f9852e48db079feb (diff)
Renamed .cc files to .cpp (fixed #983)
Diffstat (limited to 'src/core/imap/MCIMAPIdentity.cpp')
-rw-r--r--src/core/imap/MCIMAPIdentity.cpp97
1 files changed, 97 insertions, 0 deletions
diff --git a/src/core/imap/MCIMAPIdentity.cpp b/src/core/imap/MCIMAPIdentity.cpp
new file mode 100644
index 00000000..2e22d539
--- /dev/null
+++ b/src/core/imap/MCIMAPIdentity.cpp
@@ -0,0 +1,97 @@
+//
+// MCIMAPIdentity.cpp
+// mailcore2
+//
+// Created by Hoa V. DINH on 8/24/13.
+// Copyright (c) 2013 MailCore. All rights reserved.
+//
+
+#include "MCIMAPIdentity.h"
+
+using namespace mailcore;
+
+IMAPIdentity::IMAPIdentity()
+{
+ init();
+}
+
+IMAPIdentity::IMAPIdentity(IMAPIdentity * identity)
+{
+ init();
+ mc_foreachhashmapKeyAndValue(String, key, String, value, identity->mValues) {
+ mValues->setObjectForKey(key, value);
+ }
+}
+
+void IMAPIdentity::init()
+{
+ mValues = new HashMap();
+}
+
+IMAPIdentity::~IMAPIdentity()
+{
+ MC_SAFE_RELEASE(mValues);
+}
+
+void IMAPIdentity::setVendor(String * vendor)
+{
+ setInfoForKey(MCSTR("vendor"), vendor);
+}
+
+String * IMAPIdentity::vendor()
+{
+ return infoForKey(MCSTR("vendor"));
+}
+
+void IMAPIdentity::setName(String * name)
+{
+ setInfoForKey(MCSTR("name"), name);
+}
+
+String * IMAPIdentity::name()
+{
+ return infoForKey(MCSTR("name"));
+}
+
+void IMAPIdentity::setVersion(String * version)
+{
+ setInfoForKey(MCSTR("version"), version);
+}
+
+String * IMAPIdentity::version()
+{
+ return infoForKey(MCSTR("version"));
+}
+
+Array * IMAPIdentity::allInfoKeys()
+{
+ return mValues->allKeys();
+}
+
+String * IMAPIdentity::infoForKey(String * key)
+{
+ return (String *) mValues->objectForKey(key);
+}
+
+void IMAPIdentity::setInfoForKey(String * key, String * value)
+{
+ if (value != NULL) {
+ mValues->setObjectForKey(key, value->copy()->autorelease());
+ }
+ else {
+ mValues->removeObjectForKey(key);
+ }
+}
+
+Object * IMAPIdentity::copy()
+{
+ return new IMAPIdentity(this);
+}
+
+String * IMAPIdentity::description()
+{
+ return String::stringWithUTF8Format("<%s:%p %s>", className()->UTF8Characters(), this, MCUTF8DESC(mValues));
+}
+
+
+