コード例 #1
0
ファイル: dbfile.cpp プロジェクト: CloudVPS/openpanel-grace
// ========================================================================
// METHOD ::decode
// ========================================================================
void dbfile::decode (const string &outof, value &v)
{
	value tmp;
	string l, r;
	v.clear ();
	
	switch (encoding)
	{
		case shox:
			v.fromshox (outof);
			break;
		
		case attriblist: // fallthrough to valuelist
		case valuelist:
			v = strutil::splitquoted (outof, sep);
			break;
		
		case courierdb:
			tmp = strutil::split (outof, '|');
			foreach (word, tmp)
			{
				r = word;
				l = r.cutat ('=');
				v[l] = r;
			}
			break;
		
		default:
			v = outof;
			break;
	}