コード例 #1
0
void AXMLAttribute::AppendRawData(VString &pDestination) const
{
	pDestination.AppendString(fName);
	pDestination.AppendCString("=\"");
	pDestination.AppendString(fValue);
	pDestination.AppendCString("\"");
}
コード例 #2
0
void AXMLComment::AppendRawData(VString &pDestination,bool pIndented) const
{
	if (pIndented)
		SetIndent(pDestination);
	pDestination.AppendCString("<!--");
	pDestination.AppendString(fComment);
	pDestination.AppendCString("-->");
}
コード例 #3
0
void AXMLCData::AppendRawData(VString &pDestination,bool pIndented) const
{
	if (pIndented)
		SetIndent(pDestination);
	pDestination.AppendCString("<![CDATA[");
	pDestination.AppendString(fCData);
	pDestination.AppendCString("]]>");
}
コード例 #4
0
void AXMLDOCTYPE::AppendRawData(VString &pDestination,bool pIndented) const
{

	if (pIndented)
		SetIndent(pDestination);
	pDestination.AppendCString("<!DOCTYPE ");
	pDestination.AppendString(fDOCTYPE);
	pDestination.AppendCString(">");
}
コード例 #5
0
void AXMLGenericElement::SetIndent(VString &pDestination) const
{
	long	i;

#if WINVER
	pDestination.AppendCString("\r\n");
#else
	pDestination.AppendCString("\n");
#endif
	for(i = 1;i <= fLevel;i++)
		pDestination.AppendCString("\t");
}
コード例 #6
0
void AXMLDocument::AppendRawData(VString &pDestination,bool pIndented) const
{
	AXMLGenericElement		*elem;

	pDestination.AppendCString("<?xml version=\"");
	pDestination.AppendString(fVersion);
	pDestination.AppendCString("\" encoding=\"");
	pDestination.AppendString(fEncoding);
	pDestination.AppendCString("\"?>");

	elem = Get_FirstChild();
	while (elem)
	{
		elem->AppendRawData(pDestination,pIndented);
//		pDestination.AppendCString((uBYTE*)pDestination.LockAndGetCPointer());
//		pDestination.Unlock();
		elem = elem->GetNext();
	}
}
コード例 #7
0
VString VNetAddress::GetProperties(const VString& inSep) const
{
	VString props;

	xbox_assert(IsV4() || IsV6());
	xbox_assert(!(IsV4() && IsV6()));

#if !VERSIONWIN
	if(!GetName().IsEmpty())
		props.AppendString(GetName()).AppendString(inSep);
#endif
	
	props.AppendCString(IsV4() ? "v4" : "");
	props.AppendCString(IsV6() ? "v6" : "");

	if(IsV4MappedV6())
		props.AppendString(inSep).AppendCString("v4 mapped v6");
	
	if(IsLoopBack())
		props.AppendString(inSep).AppendCString("loopback");
	
	if(IsAny())
		props.AppendString(inSep).AppendCString("any");
	
	if(IsAPIPA())
		props.AppendString(inSep).AppendCString("APIPA");
	
	if(IsULA())
		props.AppendString(inSep).AppendCString("ULA");
	
	if(IsLocal())
		props.AppendString(inSep).AppendCString("Local");
	
	if(IsLocallyAssigned())
		props.AppendString(inSep).AppendCString("LocallyAssigned");

	return props;
}
コード例 #8
0
void AXMLElement::AppendRawData(VString &pDestination,bool pIndented) const
{
	AXMLGenericElement		*elem;
	AXMLAttribute			*attr;

	if (pIndented)
		SetIndent(pDestination);

	pDestination.AppendCString("<");
	pDestination.AppendString(fElementName);
	
	// attributs
	attr = fFirstAttribute;
	while(attr)
	{
		pDestination.AppendCString(" ");
		attr->AppendRawData(pDestination);
		attr = attr->fNext;
	}
	

	if (!fFirstChild)
	{	
		pDestination.AppendCString(" />");
	}
	else
	{
		pDestination.AppendCString(">");

		// enfants
		elem = Get_FirstChild();
		while (elem)
		{
			elem->AppendRawData(pDestination,pIndented);
			elem = elem->GetNext();
		}
		
		if (pIndented)
			SetIndent(pDestination);
		pDestination.AppendCString("</");
		pDestination.AppendString(fElementName);
		pDestination.AppendCString(">");
	}

}
コード例 #9
0
static void _ExplainTTRFormat_V1()
{
	VString		doc;

	char		theTime[512] = {0};
	time_t now = ::time( NULL);
	::strftime( theTime, sizeof( theTime),"%Y-%m-%dT%H:%M:%S", localtime( &now));

	doc = "Text (Tab-Tab-Return) format version ";
	doc.AppendLong(kTTR_FORMAT_VERSION);
	doc.AppendCString("\r\r");

	// ===============================================
	doc += "--------------------------------------------------\r";
	doc += "General\r";
	doc += "--------------------------------------------------\r";
	doc.AppendPrintf("Every entry is quoted by square brackets. For example: [%d] for \"FlushFromLanguage\".\r", eCLEntryKind_FlushFromLanguage);
	doc.AppendPrintf("First entry in the log is the \"start\" entry (%d), it gives the current date-time.\r", eCLEntryKind_Start);
	doc += "Then, every other entry is followed by [tab] ellapsed second since log started [tab] Task ID {and optionnaly: [tab] other infos...}\r\r";
	doc += "For example, when the log starts, first line is something like:\r";
	doc.AppendPrintf("[%d]\t%s\t10\r", eCLEntryKind_Start, theTime);
	doc += "Then you may have (FlushFromLanguage, executed 5 seconds since the log started, for task ID 10):\r";
	doc.AppendPrintf("[%d]\t5\t10\r", eCLEntryKind_FlushFromLanguage);

	doc += "\rEntries may be quoted with start/end. In this case, the format is [entry num]s and [entry num]e.";
	doc += " Between both tags, several other entries may be logged, from the same task ID or from others.\r";
	doc += "In all cases, the 'end' tag is formatted: [entry num]e [tab] ellapsed second since log started [tab] taskID [tab] count of milliseconds since [entry num]start\r";
	doc += "For example, with the FlushFromLanguage kind launched from task ID 10, the log could be:\r";
	doc.AppendPrintf("[%d]s\t123\t10\t(...other infos - see format)\r", eCLEntryKind_FlushFromLanguage);
	doc += ". . .\r. . .\r. . .\r";
	doc.AppendPrintf("[%d]s\t126\t10\t(...other infos - see format)\r", eCLEntryKind_FlushFromLanguage);

	// ===============================================
	doc += "--------------------------------------------------\r";
	doc += "List of all kinds of entry (name [tab] value)\r";
	doc += "--------------------------------------------------\r";
	doc.AppendPrintf("Unknown\t%d\r", eCLEntryKind_Unknown);
	doc.AppendPrintf("Start\t%d\r", eCLEntryKind_Start);
	doc.AppendPrintf("Stop\t%d\r", eCLEntryKind_Stop);
	doc.AppendPrintf("Comment\t%d\r", eCLEntryKind_Comment);
	doc.AppendPrintf("NeedsBytes\t%d\r", eCLEntryKind_NeedsBytes);
	doc.AppendPrintf("CallNeedsBytes\t%d\r", eCLEntryKind_CallNeedsBytes);
	doc.AppendPrintf("FlushFromLanguage\t%d\r", eCLEntryKind_FlushFromLanguage);
	doc.AppendPrintf("FlushFromMenuCommand\t%d\r", eCLEntryKind_FlushFromMenuCommand);
	doc.AppendPrintf("FlushFromScheduler\t%d\r", eCLEntryKind_FlushFromScheduler);
	doc.AppendPrintf("FlushFromBackup\t%d\r", eCLEntryKind_FlushFromBackup);
	doc.AppendPrintf("FlushFromNeedsBytes\t%d\r", eCLEntryKind_FlushFromNeedsBytes);
	doc.AppendPrintf("FlushFromRemote\t%d\r", eCLEntryKind_FlushFromRemote);
	doc.AppendPrintf("FlushFromUnknown\t%d\r", eCLEntryKind_FlushFromUnknown);
	doc.AppendPrintf("Flush\t%d\r", eCLEntryKind_Flush);
	doc.AppendPrintf("MemStats\t%d\r", eCLEntryKind_MemStats);

	doc.AppendCString("\r\r");

	// ===============================================
	doc += "--------------------------------------------------\r";
	doc += "Format and meaning of each kind\r";
	doc += "--------------------------------------------------\r";

	doc.AppendPrintf("[%d]\r", eCLEntryKind_Unknown);
	doc += "Unknown entry kind\r";
	doc.AppendPrintf("[%d] [tab] ellapsed second since log started [tab] taskID\r\r", eCLEntryKind_Unknown);

	doc.AppendPrintf("[%d]\r", eCLEntryKind_Start);
	doc += "The log starts. Quoted (start/end) entry, with misc. infos between the start and the end.\r";
	doc.AppendPrintf("[%d]s [tab] current time [tab] taskID [tab] version [cr]\r", eCLEntryKind_Start);
	doc.AppendPrintf("struct [tab] path to host database structure file [cr]\r");
	doc.AppendPrintf("data [tab] path to host database data file [cr]\r");
	doc.AppendPrintf("[%d]e\r\r", eCLEntryKind_Start);

	doc.AppendPrintf("[%d]\r", eCLEntryKind_Stop);
	doc += "The log ends\r";
	doc.AppendPrintf("[%d] [tab] ellapsed second since log started [tab] taskID\r\r", eCLEntryKind_Stop);

	doc.AppendPrintf("[%d]\r", eCLEntryKind_Comment);
	doc += "A comment added by the developer. Comments are always quoted with start and end, a \\r is added at beginning and end.\r";
	doc.AppendPrintf("[%d]start [tab] ellapsed second since log started [tab] taskID [cr] the comment [cr] [%d]end [tab] time [tab] taskID [tab] 0 (the milliseconds)\r\r", eCLEntryKind_Comment);

	doc.AppendPrintf("[%d]\r", eCLEntryKind_NeedsBytes);
	doc += "Any source asks memory to the cache manager\r";
	doc.AppendPrintf("[%d] [tab] ellapsed second since log started [tab] taskID [tab] task name [tab] process 4D num [tab] needed bytes (very large int.)\r", eCLEntryKind_NeedsBytes);
	doc.AppendPrintf("Note: may be followed by [%d]\r\r", eCLEntryKind_MemStats);

	doc.AppendPrintf("[%d]\r", eCLEntryKind_CallNeedsBytes);
	doc += "Memory manager asks memory to the cache manager: not enough space in the cache to allocate memory. The cache manager will try to free unused objects, to flush, etc...\r";
	doc.AppendPrintf("[%d] [tab] ellapsed second since log started [tab] taskID [tab] task name [tab] process 4D num [tab] needed bytes (very large int.)\r", eCLEntryKind_CallNeedsBytes);
	doc.AppendPrintf("Note: may be followed by [%d]\r\r", eCLEntryKind_MemStats);

	doc.AppendPrintf("[%d], [%d], [%d], [%d], [%d], [%d], [%d]\r", eCLEntryKind_FlushFromLanguage,
																	eCLEntryKind_FlushFromMenuCommand,
																	eCLEntryKind_FlushFromScheduler,
																	eCLEntryKind_FlushFromBackup,
																	eCLEntryKind_FlushFromNeedsBytes,
																	eCLEntryKind_FlushFromRemote,
																	eCLEntryKind_FlushFromUnknown);
	doc += "Action at the origin of a flush. All the 'FlushFrom...' share the same format.\r";
	doc.AppendPrintf("[%d] [tab] ellapsed second since log started [tab] taskID [tab] task name [tab] process 4D num [tab] isWaitUntilDone (1 = yes, 0 = no, -1 = unknown) [tab] isEmptyCache (1 = yes, 0 = no, -1 = unknown)\r", eCLEntryKind_CallNeedsBytes);
	doc.AppendPrintf("Note: may be followed by [%d]\r", eCLEntryKind_MemStats);
	doc.AppendPrintf("Note: [%d] means a flush was requested from the remote, but we don't have the exact origin (does a client called FLUSH BUFFERS explicitely? ...)\r\r", eCLEntryKind_FlushFromRemote);

	doc.AppendPrintf("[%d]\r", eCLEntryKind_Flush);
	doc += "Flush (we are inside the Flush Manager)\r";
	doc.AppendPrintf("[%d] [tab] ellapsed second since log started [tab] taskID\r", eCLEntryKind_Flush);
	doc.AppendPrintf("Note: may be followed by [%d]\r\r", eCLEntryKind_MemStats);

	doc.AppendPrintf("[%d]\r", eCLEntryKind_MemStats);
	doc += "The memory statistics. Level of stats is a bit field, to get specific stats, add the following values:\r";
	doc.AppendPrintf("Mini stats (default value): %d\r", eCLDumpStats_Mini);
	doc.AppendPrintf("Objects: %d\r", eCLDumpStats_Objects);
	doc.AppendPrintf("Blocks: %d\r", eCLDumpStats_Blocks);
	doc.AppendPrintf("SmallBlocks: %d\r", eCLDumpStats_SmallBlocks);
	doc.AppendPrintf("BigBlocks: %d\r", eCLDumpStats_BigBlocks);
	doc.AppendPrintf("OtherBlocks: %d\r", eCLDumpStats_OtherBlocks);
	doc.AppendPrintf("All: %d\r", eCLDumpStats_All);

	doc.AppendPrintf("[%d] [tab] ellapsed second since log started [tab] taskID [tab] origin of the stats (a log entry number) [cr] the stats\r", eCLEntryKind_MemStats);
	doc += "the stats themselves are in xml:\r";
	doc += "Main tag: <mem_stats level=\"stat level\" size=\"total amount of memory\" used=\"amount ofused memory\">\r";
	doc += "Then come the details:\r";
	doc += "<system phys=\"physical memory size\" free=\"free memory size\" app_used_phys=\"physical used by app\" used_virtual=\"virtual meory used\" />\r";
	doc += "Allocations blocks: <alloc count=\"number of virtual allocations\" tot=\"total allocated\" />\r";
	doc += "Then come the detailed stats, depending on the level. Note: infos are the same as the one found in GET CACHE STATISTIC.";
	doc += ", the xml uses some abbreviations to reduce a bit the size: bb = \"big blocks\", sb = \"small blocks\", ob = \"other blocks\"\r";
	doc += "Example of log:\r";

	doc += "<mem_stats level=\"1\" tid=\"13\" tname=\"P_1\" pnum=\"5\" size=\"10704570434977792\" used=\"2306663092733982407\">\r";
	doc += "<system phys=\"2143993856\" free=\"1\" app_used_phys=\"2882306048\" used_virtual=\"0\"/>";
	doc += "<alloc count=\"2\" tot=\"104857600\"/>";
	doc += "<stats free=\"102365184\" nb_bb=\"165\" used_bb=\"163\" free_bb=\"2\" nb_pages=\"104\" nb_sb=\"4411\" used_sb=\"4401\" free_sb=\"10\" biggest_block=\"70124512\" biggest_free_block=\"70124512\" nb_obj=\"3852\"/>";
	doc += "</mem_stats>\r\r";

	VFolder *userDocsFolder = VFolder::RetainSystemFolder(eFK_UserDocuments, false);
	if(userDocsFolder != NULL)
	{
		VFile	logDoc(*userDocsFolder, CVSTR("cache_log_doc_v1.txt"));

		VError err = VE_OK;
		if(logDoc.Exists())
			err = logDoc.Delete();

		err = logDoc.Create();

		if(err == VE_OK)
		{
			VFileStream logDocDump(&logDoc);

			err = logDocDump.OpenWriting();

			if(err == VE_OK)
			{
				logDocDump.PutText(doc);
			}
			
			
			if(err == VE_OK)
				err = logDocDump.CloseWriting();
		}
		userDocsFolder->Release();
	}

}