File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -78,6 +78,59 @@ bool CStringMap::Select( const char * pszKey )
7878 return bRes;
7979}
8080
81+ /* *
82+ * @ingroup SipPlatform
83+ * @brief 문자열 맵 자료구조에 문자열 키가 존재하는지 검색한다.
84+ * @param pszKey 문자열 키
85+ * @param strValue 키에 대한 값을 저장할 변수
86+ * @returns 문자열 맵 자료구조에 문자열 키가 존재하면 true 를 리턴하고 그렇지 않으면 false 를 리턴한다.
87+ */
88+ bool CStringMap::Select ( const char * pszKey, std::string & strValue )
89+ {
90+ STRING_MAP::iterator itMap;
91+ bool bRes = false ;
92+
93+ strValue.clear ();
94+
95+ if ( pszKey == NULL ) return false ;
96+
97+ m_clsMutex.acquire ();
98+ itMap = m_clsMap.find ( pszKey );
99+ if ( itMap != m_clsMap.end () )
100+ {
101+ strValue = itMap->second ;
102+ bRes = true ;
103+ }
104+ m_clsMutex.release ();
105+
106+ return bRes;
107+ }
108+
109+ /* *
110+ * @ingroup SipPlatform
111+ * @brief 문자열 맵 자료구조에 문자열 키가 존재하면 삭제한다.
112+ * @param pszKey 문자열 키
113+ * @returns 문자열 맵 자료구조에 문자열 키가 존재하면 true 를 리턴하고 그렇지 않으면 false 를 리턴한다.
114+ */
115+ bool CStringMap::Delete ( const char * pszKey )
116+ {
117+ STRING_MAP::iterator itMap;
118+ bool bRes = false ;
119+
120+ if ( pszKey == NULL ) return false ;
121+
122+ m_clsMutex.acquire ();
123+ itMap = m_clsMap.find ( pszKey );
124+ if ( itMap != m_clsMap.end () )
125+ {
126+ m_clsMap.erase ( itMap );
127+ bRes = true ;
128+ }
129+ m_clsMutex.release ();
130+
131+ return bRes;
132+ }
133+
81134/* *
82135 * @ingroup SipPlatform
83136 * @brief 문자열 맵 자료구조에 저장된 문자열 개수를 리턴한다.
Original file line number Diff line number Diff line change @@ -37,6 +37,8 @@ class CStringMap
3737
3838 bool Insert ( const char * pszKey, const char * pszValue );
3939 bool Select ( const char * pszKey );
40+ bool Select ( const char * pszKey, std::string & strValue );
41+ bool Delete ( const char * pszKey );
4042 int GetCount ( );
4143 void DeleteAll ( );
4244
You can’t perform that action at this time.
0 commit comments