示例#1
0
	void print(int level, FILE *file)
	{
		int count = 0;

		fprintf (file, "{");

		for (map<StringObject *, BaseObject *>::iterator iter = m_map.begin(); iter != m_map.end(); iter ++)
		{
			if (count > 0)
			{
				fprintf (file, ", ");
			}

			StringObject *key = iter->first;
			BaseObject *obj = iter->second;

			key->print(level, file);
			fprintf (file, ": ");
			obj->print(level + 1, file);
			count ++;
		}

		fprintf (file, "}");

	}
示例#2
0
	void print(int level, FILE *file)
	{
		int count = 0;

		fprintf (file, "[");

		for (list<BaseObject *>::iterator iter = m_list.begin(); iter != m_list.end(); iter ++)
		{
			if (count > 0)
			{
				fprintf (file, ", ");
			}
			BaseObject *obj = *iter;
			obj->print(level + 1, file);
			count ++;
		}

		fprintf (file, "]");
	}