Example #1
0
void SortStringArray( Array<String> & strings )
{
	if ( strings.GetSize() > 1 )
	{
		qsort( ( void * )&strings[ 0 ], strings.GetSize(), sizeof( String ), StringCompare );
	}
}
Example #2
0
PRAGMA_DISABLE_POP_MSVC // warning C6262: Function uses '262212' bytes of stack

// DoPieChart
//------------------------------------------------------------------------------
void Report::DoPieChart( const Array< PieItem > & items, const char * units )
{
	AStackString<> buffer;

	uint32_t height = Math::Max< uint32_t >( 140, 40 + 25 * (uint32_t)items.GetSize() );

	m_NumPieCharts++;

	Write( "<section>\n" );
	Write( "<div>\n" );
	Write( "<canvas id=\"canvas%u\" width=\"500\" height=\"%u\">\n", m_NumPieCharts, height );
	Write( "HTML5 Canvas support required.\n" );
	Write( "</canvas>\n" );
	Write( "</div>\n" );

	Write( "<script type=\"text/javascript\">\n" );
	Write( "	var myData = [" );
	for ( size_t i=0; i<items.GetSize(); ++i )
	{
		if ( i > 0 )
		{
			Write( "," );
		}
		buffer.Format( "%2.3f", items[ i ].value );
		Write( buffer.Get() );
	}
	Write( "];\n" );
	Write( "	var myLabels = [" );
	for ( size_t i=0; i<items.GetSize(); ++i )
	{
		if ( i > 0 )
		{
			Write( "," );
		}
		Write( "\"%s\"", items[ i ].label );
	}
	Write( "];\n" );
	Write( "	var myColors = [" );
	for ( size_t i=0; i<items.GetSize(); ++i )
	{
		if ( i > 0 )
		{
			Write( "," );
		}
		Write( "\"#%x\"", items[ i ].color );
	}
	Write( "];\n" );

	Write( "	plotData(\"canvas%u\",myData,myLabels,myColors,\"%s\");\n", m_NumPieCharts, units );
	Write( "</script>\n" );
	Write( "</section>\n" );
}
Example #3
0
		Array(const Array& v)
		: mdata(0),mmaxsize(v.GetSize()),moffset(v.GetSize()),readonly(false)
		{
			if ( mmaxsize )
			{
				mdata = new T[mmaxsize];

				for ( int i=0; i<mmaxsize; ++i )
					mdata[i] = v.mdata[i];
			}
		}
int WINAPI WinMain(HINSTANCE hinst, HINSTANCE prevInst, LPSTR inArgs, int show)
{
    using namespace OVR;
    using namespace OVR::Platform;

    OVR_UNUSED2(prevInst, show);
    
    // CreateApplication must be the first call since it does OVR::System::Initialize.
    Application*     app = Application::CreateApplication();
    Win32::PlatformCore* platform = new Win32::PlatformCore(app, hinst);
    // The platform attached to an app will be deleted by DestroyApplication.
    app->SetPlatformCore(platform);

    int exitCode = 0;

    // Nested scope for container destructors to shutdown before DestroyApplication.
    {
        Array<String>      args;
        Array<const char*> argv;
        argv.PushBack("app");

        const char* p = inArgs;
        const char* pstart = inArgs;
        while (*p)
        {
            if (*p == ' ')
            {
                args.PushBack(String(pstart, p - pstart));
                while (*p == ' ')
                    p++;
                pstart = p;
            }
            else
            {
                p++;
            }
        }
        if (p != pstart)
            args.PushBack(String(pstart, p - pstart));
        for (UPInt i = 0; i < args.GetSize(); i++)
            argv.PushBack(args[i].ToCStr());

        exitCode = app->OnStartup((int)argv.GetSize(), &argv[0]);
        if (!exitCode)
            exitCode = platform->Run();
    }

    // No OVR functions involving memory are allowed after this.
    Application::DestroyApplication(app);
    app = 0;

    OVR_DEBUG_STATEMENT(_CrtDumpMemoryLeaks());
    return exitCode;
}
Example #5
0
 bool Array<T>::operator ==(const Array& lhs,
                            const Array& rhs) {
     
     if((lhs->GetSize()) == (rhs->GetSize())) {
         cout<<"they are not equal "<<endl;
     }
     for(int indexTemp = 0 , size = lhs->GetSize();
         indexTemp < size;
         ++indexTemp) {
             
     }
     
    }
Example #6
0
static void TestAllItemsAreValid( const Array<TestCreateDestroyClass>& v )
{
    for( Uint32 i = 0; i < v.GetSize(); i++ )
    {
        UT_ASSERT(v[i].isValid());
    }
}
void SensorCalibration::DebugClearHeadsetTemperatureReports()
{
    OVR_ASSERT(pSensor != NULL);

    bool result;

	Array<Array<TemperatureReport> > temperatureReports;
	pSensor->GetAllTemperatureReports(&temperatureReports);

	OVR_ASSERT(temperatureReports.GetSize() > 0);
	OVR_ASSERT(temperatureReports[0].GetSize() > 0);

	TemperatureReport& tr = TemperatureReports[0][0];

	tr.ActualTemperature = 0.0;
	tr.Time = 0;
	tr.Version = 0;
	tr.Offset.x = tr.Offset.y = tr.Offset.z = 0.0;

	for (UByte i = 0; i < tr.NumBins; i++)
	{
		tr.Bin = i;

		for (UByte j = 0; j < tr.NumSamples; j++)
		{
			tr.Sample = j;

			result = pSensor->SetTemperatureReport(tr);
			OVR_ASSERT(result);
			
			// Need to wait for the tracker board to finish writing to eeprom.
			Thread::MSleep(50);
		}
	}
}
// AllocateFromSystemAllocator
//------------------------------------------------------------------------------
/*static*/ float TestSmallBlockAllocator::AllocateFromSystemAllocator( const Array< uint32_t > & allocSizes, const uint32_t repeatCount )
{
    const size_t numAllocs = allocSizes.GetSize();

    Array< void * > allocs( numAllocs, false );
    Timer timer;

    for ( size_t r=0; r<repeatCount; ++r )
    {
        // use malloc
        for ( uint32_t i=0; i<numAllocs; ++i )
        {
            uint32_t * mem = (uint32_t *)malloc( allocSizes[i] );
            allocs.Append( mem );
        }

        // use free
        for ( uint32_t i=0; i<numAllocs; ++i )
        {
            void * mem = allocs[ i ];
            free( mem );
        }

        allocs.Clear();
    }

    return timer.GetElapsed();
}
Example #9
0
// Commit
//------------------------------------------------------------------------------
/*virtual*/ bool FunctionCopyDir::Commit( NodeGraph & nodeGraph, const BFFIterator & funcStartIter ) const
{
    // Get input paths
    Array< AString > inputPaths;
    if ( !GetFolderPaths( funcStartIter, inputPaths, ".SourcePaths", true ) )
    {
        return false; // GetFolderPaths will have emitted an error
    }

    // get the optional params
    Array< AString > patterns;
    bool recurse = true;
    Array< AString > excludePaths;
    if ( !GetStrings( funcStartIter, patterns, ".SourcePathsPattern" ) ||
         !GetBool( funcStartIter, recurse, ".SourcePathsRecurse", true ) || // recursive by default
         !GetStrings( funcStartIter, excludePaths, ".SourceExcludePaths" ) )
    {
        return false; // Get* will have emitted error
    }

    // convert input paths to DirectoryListNodes
    Dependencies staticDeps( inputPaths.GetSize() );
    if ( !GetDirectoryListNodeList( nodeGraph, funcStartIter, inputPaths, excludePaths, Array< AString >(), Array< AString >(), recurse, patterns.IsEmpty() ? nullptr : &patterns, ".SourcePaths", staticDeps ) )
    {
        return false; // GetDirectoryListNodeList will have emitted an error
    }

    // Get output path
    AStackString<> destPath;
    if ( !GetString( funcStartIter, destPath, ".Dest", true ) )
    {
        return false;
    }
    NodeGraph::CleanPath( destPath );

    // Pre-build dependencies
    Dependencies preBuildDeps;
    if ( !GetNodeList( nodeGraph, funcStartIter, ".PreBuildDependencies", preBuildDeps, false ) )
    {
        return false; // GetNodeList will have emitted an error
    }

    // sanity check we defined something useful
    if ( staticDeps.IsEmpty() )
    {
        Error::Error_1006_NothingToBuild( funcStartIter, this );
        return false;
    }

    // check node doesn't already exist
    if ( nodeGraph.FindNode( m_AliasForFunction ) )
    {
        Error::Error_1100_AlreadyDefined( funcStartIter, this, m_AliasForFunction );
        return false;
    }

    // create our node
    nodeGraph.CreateCopyDirNode( m_AliasForFunction, staticDeps, destPath, preBuildDeps );
    return true;
}
Example #10
0
// JobSubQueue:QueueJobs
//------------------------------------------------------------------------------
void JobSubQueue::QueueJobs( Array< Node * > & nodes )
{
    // Create wrapper Jobs around Nodes
    Array< Job * > jobs( nodes.GetSize() );
    for ( Node * node : nodes )
    {
    	Job * job = FNEW( Job( node ) );
        jobs.Append( job );
    }

    // Sort Jobs by cost
	JobCostSorter sorter;
	jobs.Sort( sorter );

	// lock to add job
	MutexHolder mh( m_Mutex );
    const bool wasEmpty = m_Jobs.IsEmpty();

	m_Jobs.Append( jobs );
    m_Count += (uint32_t)jobs.GetSize();

    if ( wasEmpty )
    {
        return; // skip re-sorting
    }

    // sort merged lists
	m_Jobs.Sort( sorter );
}
Example #11
0
// PopulateString
//------------------------------------------------------------------------------
bool Function::PopulateString( const BFFIterator & iter, void * base, const ReflectedProperty & property, const BFFVariable * variable ) const
{
	Array< AString > strings;
	if ( !PopulateStringHelper( iter, property.HasMetaData< Meta_Path >(), property.HasMetaData< Meta_File >(), variable, strings ) )
	{
		return false; // PopulateStringHelper will have emitted an error
	}

	if ( variable->IsString() )
	{
		// Handle empty strings
		if ( strings.IsEmpty() || strings[0].IsEmpty() )
		{
			Error::Error_1004_EmptyStringPropertyNotAllowed( iter, this, variable->GetName().Get() );
			return false;
		}

		if ( strings.GetSize() != 1 )
		{
			Error::Error_1050_PropertyMustBeOfType( iter, this, variable->GetName().Get(), BFFVariable::VAR_ARRAY_OF_STRINGS, BFFVariable::VAR_STRING );
			return false;
		}

		// String to String
		property.SetProperty( base, strings[0] );
		return true;
	}

	Error::Error_1050_PropertyMustBeOfType( iter, this, variable->GetName().Get(), variable->GetType(), BFFVariable::VAR_STRING );
	return false;
}
void GyroTempCalibration::GyroCalibrationFromString(const String& str)
{

	Array<String> tokens;
	TokenizeString(&tokens, str, ' ');

	if (tokens.GetSize() != GyroCalibrationNumBins * GyroCalibrationNumSamples * 6)
	{
		LogError("Format of gyro calibration string in profile is incorrect.");
//		OVR_ASSERT(false);	// LDC - Asserts are currently not handled well on mobile.
		return;
	}

	for (int binIndex = 0; binIndex < GyroCalibrationNumBins; binIndex++)
	{
		for (int sampleIndex = 0; sampleIndex < GyroCalibrationNumSamples; sampleIndex++)
		{
			GyroCalibrationEntry& entry = GyroCalibration[binIndex][sampleIndex];
			
			int index = binIndex * GyroCalibrationNumSamples + sampleIndex;

			StringUtils::StringTo<UInt32>(entry.Version, tokens[index * 6 + 0].ToCStr());
			StringUtils::StringTo<double>(entry.ActualTemperature, tokens[index * 6 + 1].ToCStr());
			StringUtils::StringTo<UInt32>(entry.Time, tokens[index * 6 + 2].ToCStr());
			StringUtils::StringTo<double>(entry.Offset.x, tokens[index * 6 + 3].ToCStr());
			StringUtils::StringTo<double>(entry.Offset.y, tokens[index * 6 + 4].ToCStr());
			StringUtils::StringTo<double>(entry.Offset.z, tokens[index * 6 + 5].ToCStr());
		}	
	}
}
Example #13
0
// WriteNestedProjects
//------------------------------------------------------------------------------
void SLNGenerator::WriteNestedProjects( const Array< AString > & solutionProjectsToFolder,
                                        const Array< AString > & solutionFolderPaths )
{
    if ( solutionProjectsToFolder.GetSize() == 0 &&
            solutionFolderPaths.GetSize() == 0 )
    {
        return; // skip global section
    }

    Write( "\tGlobalSection(NestedProjects) = preSolution\r\n" );

    // Write every project to solution folder relationships
    const AString * const solutionProjectsToFolderEnd = solutionProjectsToFolder.End();
    for( const AString * it = solutionProjectsToFolder.Begin() ; it != solutionProjectsToFolderEnd ; ++it )
    {
        Write( it->Get() );
    }

    // Write every intermediate path
    const AString * const solutionFolderPathsEnd = solutionFolderPaths.End();
    for( const AString * it = solutionFolderPaths.Begin() ; it != solutionFolderPathsEnd ; ++it )
    {
        // parse solution folder parent path
        AStackString<> solutionFolderParentGuid;
        const char * lastSlash = it->FindLast( NATIVE_SLASH );
        if ( lastSlash )
        {
            AStackString<> solutionFolderParentPath( it->Get(), lastSlash );
            VSProjectGenerator::FormatDeterministicProjectGUID( solutionFolderParentGuid, solutionFolderParentPath );
        }

        if ( solutionFolderParentGuid.GetLength() > 0 )
        {
            // generate a guid for the solution folder
            AStackString<> solutionFolderGuid;
            VSProjectGenerator::FormatDeterministicProjectGUID( solutionFolderGuid, *it );

            solutionFolderGuid.ToUpper();
            solutionFolderParentGuid.ToUpper();

            // write parent solution folder relationship
            Write( "\t\t%s = %s\r\n", solutionFolderGuid.Get(), solutionFolderParentGuid.Get() );
        }
    }

    Write( "\tEndGlobalSection\r\n" );
}
Example #14
0
// GetDirectoryNodeList
//------------------------------------------------------------------------------
bool Function::GetDirectoryListNodeList( const BFFIterator & iter,
										 const Array< AString > & paths,
										 const Array< AString > & excludePaths,
                                         const Array< AString > & filesToExclude,
										 bool recurse,
										 const Array< AString > * patterns,
										 const char * inputVarName,
										 Dependencies & nodes ) const
{
	NodeGraph & ng = FBuild::Get().GetDependencyGraph();

	// Handle special case of excluded files beginning with ../
	// Since they can be used seinsibly by matching just the end
	// of a path, assume they are relative to the working dir.
	// TODO:C Move this during bff parsing when everything is using reflection
	Array< AString > filesToExcludeCleaned( filesToExclude.GetSize(), true );
	for ( const AString& file : filesToExclude )
	{
		if ( file.BeginsWith( ".." ) )
		{
			AStackString<> fullPath;
			NodeGraph::CleanPath( file, fullPath );
			filesToExcludeCleaned.Append( fullPath );
		}
		else
		{
			filesToExcludeCleaned.Append( file );
		}
	}

	const AString * const  end = paths.End();
	for ( const AString * it = paths.Begin(); it != end; ++it )
	{
		const AString & path = *it;

		// get node for the dir we depend on
		AStackString<> name;
		DirectoryListNode::FormatName( path, patterns, recurse, excludePaths, filesToExcludeCleaned, name );
		Node * node = ng.FindNode( name );
		if ( node == nullptr )
		{
			node = ng.CreateDirectoryListNode( name,
											   path,
											   patterns,
											   recurse,
											   excludePaths, 
                                               filesToExcludeCleaned );
		}
		else if ( node->GetType() != Node::DIRECTORY_LIST_NODE )
		{
			Error::Error_1102_UnexpectedType( iter, this, inputVarName, node->GetName(), node->GetType(), Node::DIRECTORY_LIST_NODE );
			return false;
		}

		nodes.Append( Dependency( node ) );
	}
	return true;
}
Example #15
0
Directx::TGeometry::TGeometry(const ArrayBridge<uint8>&& Data,const ArrayBridge<size_t>&& _Indexes,const SoyGraphics::TGeometryVertex& Vertex,TContext& ContextDx) :
	mVertexDescription	( Vertex ),
	mIndexCount			( 0 )
{
	Array<uint32> Indexes;
	for ( int i=0;	i<_Indexes.GetSize();	i++ )
		Indexes.PushBack( size_cast<uint32>( _Indexes[i] ) );


	// Set up the description of the static vertex buffer.
	D3D11_BUFFER_DESC vertexBufferDesc;
	vertexBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
	vertexBufferDesc.ByteWidth = Data.GetDataSize();//Vertex.GetDataSize();
	vertexBufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
	vertexBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
	vertexBufferDesc.MiscFlags = 0;
	vertexBufferDesc.StructureByteStride = Vertex.GetStride(0);	//	should be 0

	// Give the subresource structure a pointer to the vertex data.
	D3D11_SUBRESOURCE_DATA vertexData;
	vertexData.pSysMem = Data.GetArray();
	vertexData.SysMemPitch = 0;
	vertexData.SysMemSlicePitch = 0;

	// Set up the description of the static index buffer.
	D3D11_BUFFER_DESC indexBufferDesc;

	indexBufferDesc.Usage = D3D11_USAGE_DEFAULT;
	indexBufferDesc.ByteWidth = Indexes.GetDataSize();
	indexBufferDesc.BindFlags = D3D11_BIND_INDEX_BUFFER;
	indexBufferDesc.CPUAccessFlags = 0;
	indexBufferDesc.MiscFlags = 0;
	indexBufferDesc.StructureByteStride = 0;

	// Give the subresource structure a pointer to the index data.
	D3D11_SUBRESOURCE_DATA indexData;
	indexData.pSysMem = Indexes.GetArray();
	indexData.SysMemPitch = 0;
	indexData.SysMemSlicePitch = 0;


	auto& Device = ContextDx.LockGetDevice();
	try
	{
		auto Result = Device.CreateBuffer(&vertexBufferDesc, &vertexData, &mVertexBuffer.mObject );
		Directx::IsOkay( Result, "Create vertex buffer");

		Result = Device.CreateBuffer(&indexBufferDesc, &indexData, &mIndexBuffer.mObject );
		Directx::IsOkay( Result, "Create index buffer");
		mIndexCount = Indexes.GetSize();
		mIndexFormat = DXGI_FORMAT_R32_UINT;
	}
	catch( std::exception& e)
	{
		ContextDx.Unlock();
		throw;
	}
}
Example #16
0
static void TestDataAlignmentT()
{
    Array<TYPE> v;
    v.PushBack( TYPE() );

    UT_ASSERT(v.GetSize() == 1);
    UT_ASSERT(((long)v.GetData()) % AligmentSize == 0);

}
Example #17
0
void PackVertexAttribute( Array< uint8_t > & packed, const Array< _attrib_type_ > & attrib,
				const int glLocation, const int glType, const int glComponents )
{
	if ( attrib.GetSize() > 0 )
	{
		const size_t offset = packed.GetSize();
		const size_t size = attrib.GetSize() * sizeof( attrib[0] );

		packed.Resize( offset + size );
		memcpy( &packed[offset], attrib.GetDataPtr(), size );

		glEnableVertexAttribArray( glLocation );
		glVertexAttribPointer( glLocation, glComponents, glType, false, sizeof( attrib[0] ), (void *)( offset ) );
	}
	else
	{
		glDisableVertexAttribArray( glLocation );
	}
}
Example #18
0
		void operator = (const Array& v)
		{
			assert( readonly == false );

			int size = v.GetSize();
			SetSize(size,false);

			for ( int i=0; i<size; ++i )
				mdata[i] = v.mdata[i];
		}
Example #19
0
T less_(Array<T>arr, T value) {
	T min = value;
	int size = arr.GetSize();
	for (int i = 0; i < size; i++) {
		if (arr[i] < min) {
			min = arr[i];
		}
	}
	return min;
}
Example #20
0
// Save (SLNDependency)
//------------------------------------------------------------------------------
/*static*/ void SLNDependency::Save( IOStream & stream, const Array< SLNDependency > & slnDeps )
{
    const uint32_t num = (uint32_t)slnDeps.GetSize();
    stream.Write( num );
    for ( const SLNDependency & deps : slnDeps )
    {
        stream.Write( deps.m_Projects );
        stream.Write( deps.m_Dependencies );
    }
}
Example #21
0
// FixupPathForVSIntegration_GCC
//------------------------------------------------------------------------------
/*static*/ void Node::FixupPathForVSIntegration_GCC( AString & line, const char * tag )
{
	AStackString<> beforeTag( line.Get(), tag );
	Array< AString > tokens;
	beforeTag.Tokenize( tokens, ':' );
	const size_t numTokens = tokens.GetSize();
	if ( numTokens < 3 )
	{
		return; // not enough : to be correctly formatted
	}

	// are last two tokens numbers?
	int row, column;
	if ( ( sscanf_s( tokens[ numTokens - 1 ].Get(), "%i", &column ) != 1 ) ||
		 ( sscanf_s( tokens[ numTokens - 2 ].Get(), "%i", &row ) != 1 ) )
	{
		return; // failed to extract numbers where we expected them
	}

	// rebuild fixed string
	AStackString<> fixed;

	// convert path if needed;
	if ( tokens[ 0 ].GetLength() == 1 )
	{
		ASSERT( numTokens >= 4 ); // should have an extra token due to ':'
		fixed = tokens[ 0 ]; // already a full path
	}
	else
	{
		NodeGraph::CleanPath( tokens[ 0 ], fixed );
	}

	// insert additional tokens
	for ( size_t i=1; i<( numTokens-2 ); ++i )
	{
		if ( i != 0 )
		{
			fixed += ':';
		}
		fixed += tokens[ i ];
	}

	// format row, column
	fixed += '(';
	fixed += tokens[ numTokens - 2 ];
	fixed += ',';
	fixed += tokens[ numTokens - 1 ];
	fixed += ')';

	// remained of msg is untouched
	fixed += tag;

	line = fixed;
}
Example #22
0
NitsEndTest

NitsTestWithSetup(TestInlineCOWFromEmptyVector, TestArraySetup)
{
    Array< int > v;

    int* p = v.GetWritableData();

    UT_ASSERT(0 == p);
    UT_ASSERT(v.GetSize() == 0);
}
Example #23
0
File: Game.cpp Project: m1h4/Xetrix
bool MouseGame(LPARAM lParam,WPARAM /*wParam*/)
{
	double model[16],projection[16];
	int viewport[4];

	glGetIntegerv(GL_VIEWPORT,viewport);
	glGetDoublev(GL_MODELVIEW_MATRIX,model);
	glGetDoublev(GL_PROJECTION_MATRIX,projection);

	double x0,y0,z0;
	double x1,y1,z1;

	gluUnProject(LOWORD(lParam),viewport[3] - HIWORD(lParam),0.0f,model,projection,viewport,&x0,&y0,&z0);
	gluUnProject(LOWORD(lParam),viewport[3] - HIWORD(lParam),1.0f,model,projection,viewport,&x1,&y1,&z1);

	x1 -= x0;
	y1 -= y0;
	z1 -= z0;

	// Find the intersection with xOy
	double k = -z0 / z1;

	Vector2 hit(x0 + k * x1,y0 + k * y1);

	//emitter.AddParticle(Vector2(0.01f,0.01f),hit);

#ifdef _DEBUG
	for(unsigned long i = 0; i < gameMissles.GetSize(); ++i)
	{
		if((gameMissles[i]->m_position - hit).GetLength() < 0.4f)
		{
			if(gameMissles[i]->m_spring)
				gameMissles[i]->m_spring = NULL;
			else
				gameMissles[i]->m_spring = &gameSpring1;

			return true;
		}
	}
#endif

	MisslePtr missle = new Missle;

	missle->InitializeMissle(hit);
	
	missle->m_position = gameShip.m_position + Matrix2(gameShip.m_orientation) * Vector2(0.0f,-0.25f);
	missle->m_orientation = gameShip.m_orientation - M_PI_2;
	missle->m_linearVelocity = gameShip.m_linearVelocity + Matrix2(gameShip.m_orientation) * Vector2(0.0f,-0.01f);
	missle->m_angularVelocity = gameShip.m_angularVelocity;

	gameMissles.InsertBack(missle);

	return true;
}
Example #24
0
// SLNSolutionFolder::Save
//------------------------------------------------------------------------------
/*static*/ void SLNSolutionFolder::Save( IOStream & stream, const Array< SLNSolutionFolder > & solutionFolders )
{
    uint32_t numSolutionFolders = (uint32_t)solutionFolders.GetSize();
    stream.Write( numSolutionFolders );
    for ( uint32_t i=0; i<numSolutionFolders; ++i )
    {
        const SLNSolutionFolder & sln = solutionFolders[ i ];

        stream.Write( sln.m_Path );
        stream.Write( sln.m_ProjectNames );
    }
}
Example #25
0
// GetNameForNode
//------------------------------------------------------------------------------
bool Function::GetNameForNode( const BFFIterator & iter, const ReflectionInfo * ri, AString & name ) const
{
	// get object MetaData
	const Meta_Name * nameMD = ri->HasMetaData< Meta_Name >();
	ASSERT( nameMD ); // should not call this on types without this MetaData

	// Format "Name" as ".Name" - TODO:C Would be good to eliminate this string copy
	AStackString<> propertyName( "." );
	propertyName += nameMD->GetName();

	// Find the value for this property from the BFF
	const BFFVariable * variable = BFFStackFrame::GetVar( propertyName );
    if ( variable == nullptr )
    {
        Error::Error_1101_MissingProperty( iter, this, propertyName );
        return false;        
    }
	if ( variable->IsString() )
	{
		Array< AString > strings;
		if ( !PopulateStringHelper( iter, nullptr, ri->HasMetaData< Meta_File >(), variable, strings ) )
		{
			return false; // PopulateStringHelper will have emitted an error
		}

		// Handle empty strings
		if ( strings.IsEmpty() || strings[0].IsEmpty() )
		{
			Error::Error_1004_EmptyStringPropertyNotAllowed( iter, this, variable->GetName().Get() );
			return false;
		}

		if ( strings.GetSize() != 1 )
		{
			Error::Error_1050_PropertyMustBeOfType( iter, this, variable->GetName().Get(), BFFVariable::VAR_ARRAY_OF_STRINGS, BFFVariable::VAR_STRING );
			return false;
		}

		// Check that name isn't already used
		NodeGraph & ng = FBuild::Get().GetDependencyGraph();
		if ( ng.FindNode( strings[0] ) )
		{
			Error::Error_1100_AlreadyDefined( iter, this, strings[0] );
			return false;
		}

		name = strings[0];
		return true;
	}

	Error::Error_1050_PropertyMustBeOfType( iter, this, variable->GetName().Get(), variable->GetType(), BFFVariable::VAR_STRING );
	return false;
}
Example #26
0
NitsEndTest

NitsTestWithSetup(TestDeleteTheOnlyOne, TestArraySetup)
{
    Array<TestCreateDestroyClass> v;

    v.Resize(1);

    v.Delete(0);

    UT_ASSERT(v.GetSize() == 0);
}
Example #27
0
// VSProjectFileType::Save
//------------------------------------------------------------------------------
/*static*/ void VSProjectFileType::Save( IOStream & stream, const Array< VSProjectFileType > & fileTypes )
{
    uint32_t numFileTypes = (uint32_t)fileTypes.GetSize();
    stream.Write( numFileTypes );
    for ( uint32_t i=0; i<numFileTypes; ++i )
    {
        const VSProjectFileType & ft = fileTypes[ i ];

        stream.Write( ft.m_FileType );
        stream.Write( ft.m_Pattern );
    }
}
Example #28
0
NitsEndTest

NitsTestWithSetup(TestResizeToShrink, TestArraySetup)
{
    Array<TestCreateDestroyClass> v;

    v.Resize(100);

    v.Resize(10);

    UT_ASSERT(v.GetSize() == 10);
    TestAllItemsAreValid(v);
}
Example #29
0
static void RenderRays(Array<ray3f>& rays)
{
	glBegin(GL_LINES);
	for(int i=0; i< rays.GetSize(); i++)
	{
		vector3f a = rays[i].origin;
		//vector3f b = rays[i].ray.origin + rays[i].length * rays[i].ray.direction;
		vector3f b = rays[i].origin + rays[i].direction;
		glVertex3f(a.x, a.y, a.z);
		glVertex3f(b.x, b.y, b.z);
	}
	glEnd();
}
Example #30
0
void Plex::FreeDataChain()
{
	Array<Plex*> plexAray;
	Plex* pLastPlex=this;
	while (pLastPlex->pNext)
	{
		pLastPlex=pLastPlex->pNext;
		plexAray.Add(pLastPlex);
	}
	for (int i=0; i<plexAray.GetSize(); i++)
		free((void*)plexAray[i]);
	free(this);
}