3 * Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved.
5 * This file is part of msg-service.
7 * Contact: Jaeyun Jeong <jyjeong@samsung.com>
8 * Sangkoo Kim <sangkoo.kim@samsung.com>
9 * Seunghwan Lee <sh.cat.lee@samsung.com>
10 * SoonMin Jung <sm0415.jung@samsung.com>
11 * Jae-Young Lee <jy4710.lee@samsung.com>
12 * KeeBum Kim <keebum.kim@samsung.com>
14 * PROPRIETARY/CONFIDENTIAL
16 * This software is the confidential and proprietary information of
17 * SAMSUNG ELECTRONICS ("Confidential Information"). You shall not
18 * disclose such Confidential Information and shall use it only in
19 * accordance with the terms of the license agreement you entered
20 * into with SAMSUNG ELECTRONICS.
22 * SAMSUNG make no representations or warranties about the suitability
23 * of the software, either express or implied, including but not limited
24 * to the implied warranties of merchantability, fitness for a particular
25 * purpose, or non-infringement. SAMSUNG shall not be liable for any
26 * damages suffered by licensee as a result of using, modifying or
27 * distributing this software or its derivatives.
31 #ifndef MSG_PLUGIN_CONFIG_H
32 #define MSG_PLUGIN_CONFIG_H
35 /*==================================================================================================
37 ==================================================================================================*/
44 #include "MsgCppTypes.h"
48 int tokenType; // not defined 0, title: 1, msgtype: 2, libpath: 3
49 char tokenVal[256]; // null-terminated char array
52 MsgPlgToken(char* pstr=NULL) : tokenType(TOK_UNDEFINED)
64 MsgPlgToken& operator = (const MsgPlgToken& rhs)
68 tokenType = rhs.tokenType;
69 strncpy(tokenVal, rhs.tokenVal, 255);
75 int getType() const { return tokenType; } // not defined 0, title: 1, msgtype: 2, libpath: 3
76 const char* getVal(void) const { return tokenVal; }
77 void getVal(CharVector& vec) const { vec.assign(tokenVal, tokenVal+strlen(tokenVal));}
78 int tokenize(char* pStr);
80 enum { TOK_UNDEFINED=0, TOK_PLG_TITLE, TOK_PLG_TYPE, TOK_PLG_PATH };
82 void reset() { tokenType = TOK_UNDEFINED; }
83 operator void*() const {
84 return (tokenType==TOK_UNDEFINED)? NULL:(void*) this;
88 typedef std::vector<MsgPlgToken> MsgPlgTokenVec;
89 typedef std::map<CharVector, MsgPlgTokenVec> MsgConfigMap;
93 MsgConfigMap configMap;
94 void insert(const MsgPlgToken& tokTitle, const MsgPlgToken& tokMsgType, const MsgPlgToken& tokLibPath);
97 MsgPlgConfig(FILE* fp);
99 /* access method for tokens */
100 const CharVector& title(unsigned int pos);// const; // iteration with ith position i=0, .. , itemCount-1
101 inline int titleCount() const { return configMap.size(); }
103 void token(const CharVector& key, unsigned int pos, MsgPlgToken& retTok);// const;
104 void token(int i, unsigned int pos, MsgPlgToken& retTok);// const;
105 int tokenCount(const CharVector& key) { return configMap[key].size(); } // const leads to error why?
108 #endif // MSG_PLUGIN_CONFIG_H