Exemple #1
0
void CSMMRepeater::XMLParameters(TiXmlNode *node)
{
	if(node->FirstChild("Repeats"))
		SetRepetitions(ToUInt(node->FirstChild("Repeats")->FirstChild("Bagging")),ToUInt(node->FirstChild("Repeats")->FirstChild("CrossValidation")));
	if(node->FirstChild("LambdaRange"))
		SetLambdaRange(ToDouble(node->FirstChild("LambdaRange")->FirstChild("Min")),ToDouble(node->FirstChild("LambdaRange")->FirstChild("Start")),ToDouble(node->FirstChild("LambdaRange")->FirstChild("Max")));
	if(node->FirstChild("Precission"))
		SetPrecission(ToDouble(node->FirstChild("Precission")));
	if(node->FirstChild("LogDetail"))
	{
		string detail=node->FirstChild("LogDetail")->Value();
		if(detail=="None")
			clog_detail.push_back(NONE); 
		else if(detail=="Minimal")
			clog_detail.push_back(MINIMAL); 
		else if(detail=="Medium")
			clog_detail.push_back(MEDIUM); 
		else if(detail=="Detailed")
			clog_detail.push_back(DETAILED); 
		else if(detail=="All")
			clog_detail.push_back(ALL); 
	}
	if(node->FirstChild("SeedRandomizer"))
		m_srand=ToUInt(node->FirstChild("SeedRandomizer"));
	if(node->FirstChild("MaxNormIterations"))
		SetMaxNormIterations(ToUInt(node->FirstChild("MaxNormIterations")));

}
Exemple #2
0
	Bool OpenReadOnlyTest()
	{
		Bool result = true;
		File* file;
		String text;
		UInt fileSize;

		//File does not exists, open it and it will fail
		File::Delete(_fileName);
		file = File::OpenReadOnly(_fileName);
		CHECK file == 0;

		//File exists, open it and it will work, write to it and it will fail
		CHECK (file = File::Create(_fileName));
		file->Write((VoidPtr)_fileName, String::CStrByteSize(_fileName));
		DeletePtr(file);
		CHECK (file = File::OpenReadOnly(_fileName));
		fileSize = ToUInt(file->GetFileSize());
		text.Reserve(fileSize / sizeof(TChar));
		file->Read(text.DrivePointer(fileSize / sizeof(TChar)), fileSize);
		CHECK text == _fileName;
		DeletePtr(file);

		File::Delete(_fileName);

		return result;
	}
Exemple #3
0
		Bool TextFile::ReadAll(CStr fileName, String& text, Exception* out_ex)
		{
			ASSERT_PARAMETER(fileName);
			Bool result = false;

			File* file = File::Open(fileName, File::Disposition::OpenExisting, File::Access::AccessRead, File::Flags::ShareRead | File::Flags::OptimizeForSequentialAccess, out_ex);
			if(file)
			{
				UInt fileSize = ToUInt(file->GetFileSize());
				UInt length = fileSize / sizeof(TChar);

				//If fileSize is odd then +1 will compensate the division rounding
				if(fileSize % 2)
					++fileSize;

				text.Reserve(length);

				TChar* buffer = text.DrivePointer(length);
				result = file->Read(buffer, fileSize);
				GALATEA_DELETE_PTR(file);

				if(!result)
				{
					text.Clear();
					text.Shrink();
				}
			}

			return result;
		}
Exemple #4
0
static unsigned NumberPostfix(const String& str)
{
    for (unsigned i = 0; i < str.Length(); ++i)
    {
        if (IsDigit(str[i]))
            return ToUInt(str.CString() + i);
    }

    return M_MAX_UNSIGNED;
}
Exemple #5
0
void CSMMSeqPair::XMLParameters(TiXmlNode *node)
{
	if(node->FirstChild("IndividualLambdas"))
		SetIndividualLambdas(ToBool(node->FirstChild("IndividualLambdas")));
	if(node->FirstChild("PairCoefCriteria"))
		SetPairCoefCriteria(ToUInt(node->FirstChild("PairCoefCriteria")->FirstChild("MinCount")),ToDouble(node->FirstChild("PairCoefCriteria")->FirstChild("MaxDisagrement")));
	if(node->FirstChild("SMMParameters"))
		m_smm.XMLParameters(node->FirstChild("SMMParameters"));

}
Exemple #6
0
void JSONValue::GetVariantMap(VariantMap& variantMap) const
{
    if (!IsObject())
    {
        LOGERROR("JSONValue is not a object");
        return;
    }

    for (ConstJSONObjectIterator i = Begin(); i != End(); ++i)
    {
        StringHash key(ToUInt(i->first_));
        Variant variant;
        i->second_.GetVariant(variant);
        variantMap[key] = variant;
    }
}
Server::Server(Framework *framework) :
    Object(framework->GetContext()),
    LC("[WebSocketServer]: "),
    framework_(framework),
    port_(2345)
{
    // Port
    StringList portParam = framework->CommandLineParameters("--port");
    if (!portParam.Empty())
    {
        port_ = ToUInt(portParam.Front());
        if (!port_)
        {
            port_ = 2345;
            LogWarning(LC + "Failed to parse int from --port, using default port 2345.");
        }
    }
}
bool FlatFloor::LoadParameter(const Strings& param, bool& parameterLoaded)
{

	if(param[0] == "[SegmentNum]")
	{
		m_segmentNum = ToUInt(param[1]);
		
		if(m_pCollAABB) delete m_pCollAABB;
		m_pCollAABB = new CollAABB(Vec2r(m_segmentNum * WORLD_UNIT, WORLD_UNIT));

		m_pos.X += (m_segmentNum - 1) * HALF_WORLD_UNIT;

		parameterLoaded = true;
	}
	



	return true;
}
Exemple #9
0
		String TextFile::ReadAll(CStr fileName)
		{
			Assert(fileName);
			File* file;
			String text;
			UInt fileSize;
			UInt length;
			TChar* buffer;

			file = File::OpenReadOnly(fileName);
			if(file)
			{
				fileSize = ToUInt(file->GetFileSize());
				length = fileSize / sizeof(TChar);
				text.Reserve(length);
				buffer = text.DrivePointer(length);
				file->Read(buffer, fileSize);
				DeletePtr(file);
			}

			return text;
		}
Exemple #10
0
unsigned XMLElement::GetUInt(const ea::string& name) const
{
    return ToUInt(GetAttribute(name));
}
unsigned ToUInt(const String& source)
{
    return ToUInt(source.CString());
}
void Run(const Vector<String>& arguments)
{
    if (arguments.Size() < 2)
    {
        ErrorExit(
            "Usage: OgreImporter <input file> <output file> [options]\n\n"
            "Options:\n"
            "-l      Output a material list file\n"
            "-na     Do not output animations\n"
            "-nm     Do not output morphs\n"
            "-r      Output only rotations from animations\n"
            "-s      Split each submesh into own vertex buffer\n"
            "-t      Generate tangents\n"
            "-mb <x> Maximum number of bones per submesh, default 64\n"
        );
    }

    bool generateTangents = false;
    bool splitSubMeshes = false;
    bool exportAnimations = true;
    bool exportMorphs = true;
    bool rotationsOnly = false;
    bool saveMaterialList = false;

    if (arguments.Size() > 2)
    {
        for (unsigned i = 2; i < arguments.Size(); ++i)
        {
            if (arguments[i].Length() > 1 && arguments[i][0] == '-')
            {
                String argument = arguments[i].Substring(1).ToLower();
                if (argument == "l")
                    saveMaterialList = true;
                else if (argument == "r")
                    rotationsOnly = true;
                else if (argument == "s")
                    splitSubMeshes = true;
                else if (argument == "t")
                    generateTangents = true;
                else if (argument.Length() == 2 && argument[0] == 'n')
                {
                    switch (tolower(argument[1]))
                    {
                    case 'a':
                        exportAnimations = false;
                        break;

                    case 'm':
                        exportMorphs = false;
                        break;
                    }
                    break;
                }
                else if (argument == "mb" && i < arguments.Size() - 1)
                {
                    maxBones_ = ToUInt(arguments[i + 1]);
                    if (maxBones_ < 1)
                        maxBones_ = 1;
                    ++i;
                }
            }
        }
    }

    LoadMesh(arguments[0], generateTangents, splitSubMeshes, exportMorphs);
    WriteOutput(arguments[1], exportAnimations, rotationsOnly, saveMaterialList);

    PrintLine("Finished");
}
Exemple #13
0
		bool IPv4::operator > (const IPv4& other) {
			return ToUInt() > other.ToUInt();
		}
Exemple #14
0
		bool IPv4::operator == (const IPv4& other) {
			return ToUInt() == other.ToUInt();
		}
Exemple #15
0
unsigned String::ToUInt() const
{
    return ToUInt(CString());
}
Exemple #16
0
unsigned ToUInt(const String& source, int base)
{
    return ToUInt(source.CString(), base);
}