コード例 #1
0
ファイル: dbfile.cpp プロジェクト: CloudVPS/openpanel-grace
// ========================================================================
// METHOD ::encode
// ========================================================================
void dbfile::encode (string &into, value &v)
{
	into.crop ();
	switch (encoding)
	{
		case shox:
			into = v.toshox();
			break;
		
		case attriblist:
			foreach (node, v)
			{
				if (into) into.strcat (sep);
				into.strcat ("%s=\"%S\"" %format (node.id(), node));
			}
			break;
		
		case valuelist:
			foreach (node, v)
			{
				if (into) into.strcat (sep);
				into.strcat (node.sval());
			}
			break;
			
		case courierdb:
			foreach (node, v)
			{
				if (into) into.strcat ('|');
				into.strcat ("%s=%s" %format (node.id(), node));
			}
			break;
		
		default:
			into = v.sval();
			break;
	}
}