コード例 #1
0
/*
	IMPORTANT:	the build version is created on the compilation machine. It requires that (1) perl is installed and (2) an external file contains the number.
				That's why if you compile 4D on your computer, you'll probably always get a build version of 0 (if the external file is not found, "00000" is used)
*/
sLONG VProcess::GetChangeListNumber() const
{
	sLONG changeListNumber = 0;
	VString s;
	GetBuildNumber( s);
	VIndex pos = s.FindUniChar( '.', s.GetLength(), true);
	if (pos > 0)
	{
		s.SubString( pos + 1, s.GetLength() - pos);
		changeListNumber = s.GetLong();
	}
	return changeListNumber;
}
コード例 #2
0
void XWinProcessLauncher::SetBinaryPath(const VString &inBinaryPath)
{
	delete [] fBinaryPath;
	fBinaryPath = NULL;

	// ACI0065260 - 2010-03-11, T.A.
	// Add quotes if the path contains a space and is not already quoted
	if( !inBinaryPath.IsEmpty() && inBinaryPath.FindUniChar(CHAR_SPACE) > 0 && inBinaryPath[0] != CHAR_QUOTATION_MARK )
	{
		VString		quotedPath;

		quotedPath = CHAR_QUOTATION_MARK;
		quotedPath += inBinaryPath;
		quotedPath += CHAR_QUOTATION_MARK;
		fBinaryPath = _CreateCString(quotedPath);
	}
	else
	{
		fBinaryPath = _CreateCString(inBinaryPath);
	}
}
コード例 #3
0
VError VJSONImporter::JSONObjectToBag(VValueBag& outBag)
{
	VError			err = VE_OK;
	VString			aStr;
	bool			withQuotes;
	
	// When JSONObjectToBag() recursively calls itself (because it finds a jsonBeginObject token)
	// it must not error-check this, because the token has already been read.
	if (fRecursiveCallCount == 0 && GetNextJSONToken(aStr, &withQuotes) != jsonBeginObject)
	{
		err = VE_MALFORMED_JSON_DESCRIPTION;
	}
	else
	{
		VString		name;
		
		JsonToken token = GetNextJSONToken(name, &withQuotes);
		while (token != jsonEndObject && token != jsonNone && err == VE_OK)
		{
			if (token == jsonString)
			{
				token = GetNextJSONToken(aStr, &withQuotes);
				if (token == jsonAssigne)
				{
					token = GetNextJSONToken(aStr, &withQuotes);
					switch (token)
					{
						case jsonString:
							if(name == "__CDATA")
							{
								outBag.SetCData(aStr);
							}
							else if (withQuotes)
							{
								outBag.SetString(name, aStr);
							}
							else if (aStr == L"null")
							{
								//aStr.SetNull(true);
								outBag.SetString(name, aStr);
								VValueSingle* temp = outBag.GetAttribute(name);
								aStr.SetNull(true);
								outBag.SetString(name, aStr);
							}
							else if (aStr == L"true")
							{
								outBag.SetBool(name, true);
							}
							else if (aStr == L"false")
							{
								outBag.SetBool(name, false);
							}
							else if (aStr.FindUniChar('.') > 0)
							{
								outBag.SetReal(name, aStr.GetReal());
							}
							else
							{
								outBag.SetLong8(name, aStr.GetLong8());
							}
							break;
							
						case jsonBeginObject:
						{
							VValueBag* subBag = new VValueBag();
							subBag->SetBool(L"____objectunic", true);
						++fRecursiveCallCount;
							err = JSONObjectToBag(*subBag);
						--fRecursiveCallCount;
							if (err == VE_OK)
							{
								outBag.AddElement(name, subBag);
							}
							subBag->Release();
						}
							break;
							
						case jsonBeginArray:
						{
							token = GetNextJSONToken(aStr, &withQuotes);
							while (token != jsonEndArray && token != jsonNone && err == VE_OK)
							{
								if (token == jsonBeginObject)
								{
									VValueBag* subBag = new VValueBag();
								++fRecursiveCallCount;
									err = JSONObjectToBag(*subBag);
								--fRecursiveCallCount;
									if (err == VE_OK)
									{
										outBag.AddElement(name, subBag);
									}
									subBag->Release();
								}
								token = GetNextJSONToken(aStr, &withQuotes);
								if (token == jsonSeparator)
									token = GetNextJSONToken(aStr, &withQuotes);
							}
							
						}
							break;
							
						default:
							err = VE_MALFORMED_JSON_DESCRIPTION;
							break;
					}
				}
				else
					err = VE_MALFORMED_JSON_DESCRIPTION;
			}
			else
				err = VE_MALFORMED_JSON_DESCRIPTION;
			
			if (err == VE_OK)
			{
				token = GetNextJSONToken(name, &withQuotes);
				if (token == jsonSeparator)
					token = GetNextJSONToken(name, &withQuotes);
			}
		}
	}
	
	return vThrowError(err);
}