本文整理汇总了C++中Array::Append方法的典型用法代码示例。如果您正苦于以下问题:C++ Array::Append方法的具体用法?C++ Array::Append怎么用?C++ Array::Append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Array
的用法示例。
在下文中一共展示了Array::Append方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetStrings
// GetStrings
//------------------------------------------------------------------------------
bool Function::GetStrings( const BFFIterator & iter, Array< AString > & strings, const char * name, bool required ) const
{
const BFFVariable * var;
if ( !GetStringOrArrayOfStrings( iter, var, name, required ) )
{
return false; // problem (GetStringOrArrayOfStrings will have emitted error)
}
if ( !var )
{
ASSERT( !required );
return true; // not required and not provided: nothing to do
}
if ( var->GetType() == BFFVariable::VAR_STRING )
{
strings.Append( var->GetString() );
}
else if ( var->GetType() == BFFVariable::VAR_ARRAY_OF_STRINGS )
{
const Array< AString > & vStrings = var->GetArrayOfStrings();
strings.Append( vStrings );
}
else
{
ASSERT( false );
}
return true;
}
示例2: GetDofNrs
void MyHighOrderFESpace :: GetDofNrs (int elnr, Array<int> & dnums) const
{
// returns dofs of element number elnr
dnums.SetSize(0);
Ngs_Element ngel = ma->GetElement (elnr);
// vertex dofs
for (int i = 0; i < 3; i++)
dnums.Append (ngel.vertices[i]);
// edge dofs
for (int i = 0; i < 3; i++)
{
int first = first_edge_dof[ngel.edges[i]];
int next = first_edge_dof[ngel.edges[i]+1];
for (int j = first; j < next; j++)
dnums.Append (j);
}
int first = first_cell_dof[elnr];
int next = first_cell_dof[elnr+1];
for (int j = first; j < next; j++)
dnums.Append (j);
// cout << "dnums = " << dnums << endl;
}
示例3: PushStatusF
void PushStatusF(const MyStr& s)
{
msgstatus_stack.Append(new MyStr (s));
SetStatMsg(s);
threadpercent_stack.Append(0);
PrintFnStart(s);
}
示例4: AddOption
void AddOption(bool *var, const char *enable_short_name,
const char *enable_long_name, const char *disable_short_name,
const char *disable_long_name, const char *description,
bool required = false)
{
options.Append(Option(ENABLE, var, enable_short_name, enable_long_name,
description, required));
options.Append(Option(DISABLE, var, disable_short_name, disable_long_name,
description, required));
}
示例5: TestFunction_Speed
// TestFunction_Speed
//------------------------------------------------------------------------------
void TestProjectGeneration::TestFunction_Speed() const
{
VSProjectGenerator pg;
AStackString<> baseDir( "C:\\Windows\\System32" );
Array< AString > baseDirs;
baseDirs.Append( baseDir );
// project name
pg.SetProjectName( AStackString<>( "Big" ) );
pg.SetBasePaths( baseDirs );
// platforms
Array< VSProjectConfig > configs;
VSProjectConfig cfg;
cfg.m_Platform = "Win32";
cfg.m_Config = "Debug";
configs.Append( cfg );
// files (about 5,000)
Array< AString > files;
FileIO::GetFiles( baseDir, AStackString<>( "*.mui" ), true, &files );
FileIO::GetFiles( baseDir, AStackString<>( "*.exe" ), true, &files );
FileIO::GetFiles( baseDir, AStackString<>( "*.dll" ), true, &files );
pg.AddFiles( files );
Array< VSProjectFileType > fileTypes;
{
VSProjectFileType ft;
ft.m_FileType = "CppForm";
ft.m_Pattern = "Code\\Forms\\*.h";
fileTypes.Append( ft );
ft.m_FileType = "CppControl";
ft.m_Pattern = "Controls\\*.h";
fileTypes.Append( ft );
}
AStackString<> projectFileName( "C:\\Windows\\System\\dummy.vcxproj" );
{
Timer t;
pg.GenerateVCXProj( projectFileName, configs, fileTypes );
float time = t.GetElapsed();
OUTPUT( "Gen vcxproj : %2.3fs\n", time );
}
{
Timer t;
pg.GenerateVCXProjFilters( projectFileName );
float time = t.GetElapsed();
OUTPUT( "Gen vcxproj.filters: %2.3fs\n", time );
}
}
示例6: WriteSolutionFolderListings
// WriteSolutionConfigs
//------------------------------------------------------------------------------
void SLNGenerator::WriteSolutionFolderListings( const Array< SLNSolutionFolder > & folders,
Array< AString > & solutionFolderPaths )
{
// Create every intermediate path
const SLNSolutionFolder * const foldersEnd = folders.End();
for( const SLNSolutionFolder * it = folders.Begin() ; it != foldersEnd ; ++it )
{
if ( solutionFolderPaths.Find( it->m_Path ) == nullptr )
{
solutionFolderPaths.Append( it->m_Path );
}
const char * pathEnd = it->m_Path.Find( NATIVE_SLASH );
while ( pathEnd )
{
AStackString<> solutionFolderPath( it->m_Path.Get(), pathEnd );
if ( solutionFolderPaths.Find( solutionFolderPath ) == nullptr )
{
solutionFolderPaths.Append( solutionFolderPath );
}
pathEnd = it->m_Path.Find( NATIVE_SLASH, pathEnd + 1 );
}
}
solutionFolderPaths.Sort();
// Solution Folders Listings
const AString * const solutionFolderPathsEnd = solutionFolderPaths.End();
for( const AString * it = solutionFolderPaths.Begin() ; it != solutionFolderPathsEnd ; ++it )
{
// parse solution folder name
const char * solutionFolderName = it->FindLast( NATIVE_SLASH );
solutionFolderName = solutionFolderName ? solutionFolderName + 1 : it->Get();
// generate a guid for the solution folder
AStackString<> solutionFolderGuid;
VSProjectGenerator::FormatDeterministicProjectGUID( solutionFolderGuid, *it );
// Guid must be uppercase (like visual)
solutionFolderGuid.ToUpper();
Write( "Project(\"{2150E333-8FDC-42A3-9474-1A3956D46DE8}\") = \"%s\", \"%s\", \"%s\"\r\n",
solutionFolderName, solutionFolderName, solutionFolderGuid.Get() );
Write( "EndProject\r\n" );
}
}
示例7: strcpy
unsigned operator <<= (const char* name)
{
Name new_name;
strcpy(new_name.name, name);
names.Append(new_name);
return !names - 1;
}
示例8: RegisterUserFormats
void RegisterUserFormats (Array<const char*> & names)
{
const char *types[] =
{
"Neutral Format",
"VTU Format",
"VTU Format, only volume",
"Surface Mesh Format" ,
"DIFFPACK Format",
"TecPlot Format",
"Tochnog Format",
"Abaqus Format",
"Fluent Format",
"Permas Format",
"FEAP Format",
"Elmer Format",
"STL Format",
"VRML Format",
"Gmsh Format",
"Gmsh2 Format",
"DOLFIN Format",
"JCMwave Format",
"TET Format",
"Chemnitz Format", // Why not? - Mikael
0
};
for (int i = 0; types[i]; i++)
names.Append (types[i]);
}
示例9:
void L2EnrichedQuadFESpace::GetDofNrs (int elnr, Array<int> & dnums) const {
dnums.SetSize(0);
int first = first_cell_dof[elnr];
int next = first_cell_dof[elnr+1];
for (int j = first; j < next; j++) dnums.Append (j);
}
示例10: Ng_SetPrimitiveData
int Ng_SetPrimitiveData (ClientData clientData,
Tcl_Interp * interp,
int argc, tcl_const char *argv[])
{
CSGeometry * geometry = dynamic_cast<CSGeometry*> (ng_geometry.get());
if (!geometry)
{
Tcl_SetResult (interp, err_needscsgeometry, TCL_STATIC);
return TCL_ERROR;
}
tcl_const char * name = argv[1];
tcl_const char * value = argv[2];
Array<double> coeffs;
cout << "Set primitive data, name = " << name
<< ", value = " << value << endl;
istringstream vst (value);
double val;
while (!vst.eof())
{
vst >> val;
coeffs.Append (val);
}
((Primitive*)
geometry->GetSolid (name)->GetPrimitive())->SetPrimitiveData (coeffs);
return TCL_OK;
}
示例11: PopulateStringHelper
// PopulateStringHelper
//------------------------------------------------------------------------------
bool Function::PopulateStringHelper( const BFFIterator & iter, const Meta_Path * pathMD, const Meta_File * fileMD, const BFFVariable * variable, const AString & string, Array< AString > & outStrings ) const
{
// Full paths to files can support aliases
if ( fileMD && ( !fileMD->IsRelative() ) )
{
// Is it an Alias?
Node * node = FBuild::Get().GetDependencyGraph().FindNode( string );
if ( node && ( node->GetType() == Node::ALIAS_NODE ) )
{
AliasNode * aliasNode = node->CastTo< AliasNode >();
for ( const auto& aliasedNode : aliasNode->GetAliasedNodes() )
{
if ( !PopulateStringHelper( iter, pathMD, fileMD, variable, aliasedNode.GetNode()->GetName(), outStrings ) )
{
return false; // PopulateStringHelper will have emitted an error
}
}
return true;
}
// Not an alias - fall through to normal handling
}
AStackString<> stringToFix( string );
if ( !PopulatePathAndFileHelper( iter, pathMD, fileMD, variable->GetName(), stringToFix ) )
{
return false; // PopulatePathAndFileHelper will have emitted an error
}
outStrings.Append( stringToFix );
return true;
}
示例12: GetSourceNodes
// GetSourceNodes
//------------------------------------------------------------------------------
bool FunctionCopy::GetSourceNodes( const BFFIterator & iter, Node * node, Array< Node * > & nodes ) const
{
if ( node->GetType() == Node::ALIAS_NODE )
{
// resolve aliases to real nodes
AliasNode * aliasNode = node->CastTo< AliasNode >();
const Dependencies & aliasedNodes = aliasNode->GetAliasedNodes();
const Dependency * const end = aliasedNodes.End();
for ( const Dependency * it = aliasedNodes.Begin(); it != end; ++it )
{
if ( !GetSourceNodes( iter, it->GetNode(), nodes ) )
{
return false;
}
}
return true;
}
else if ( node->IsAFile() )
{
// anything that results in a file is ok
nodes.Append( node );
return true;
}
// something we don't know how to handle
Error::Error_1005_UnsupportedNodeType( iter, this, ".Source", node->GetName(), node->GetType() );
return false;
}
示例13: GetStringOrArrayOfStringsFromStruct
// GetStringOrArrayOfStringsFromStruct
//------------------------------------------------------------------------------
bool FunctionSLN::GetStringOrArrayOfStringsFromStruct( const BFFIterator & iter, const BFFVariable * s, const char * name, Array< AString > & result ) const
{
for ( const BFFVariable * v : s->GetStructMembers() )
{
if ( v->GetName() == name )
{
if ( ( v->IsArrayOfStrings() == false ) && ( v->IsString() == false ) )
{
Error::Error_1050_PropertyMustBeOfType( iter, this, name, v->GetType(), BFFVariable::VAR_ARRAY_OF_STRINGS, BFFVariable::VAR_STRING );
return false;
}
if ( v->IsArrayOfStrings() )
{
result = v->GetArrayOfStrings();
}
else
{
result.Append( v->GetString() );
}
return true; // found
}
}
// TODO:B custom error
Error::Error_1101_MissingProperty( iter, this, AStackString<>( name ) );
return false;
}
示例14: LoadNaomi
STLGeometry * STLTopology :: LoadNaomi (istream & ist)
{
int i;
STLGeometry * geom = new STLGeometry();
Array<STLReadTriangle> readtrigs;
PrintFnStart("read NAOMI file format");
char buf[100];
Vec<3> normal;
//int cntface = 0;
//int cntvertex = 0;
double px, py, pz;
int noface, novertex;
Array<Point<3> > readpoints;
ist >> buf;
if (strcmp (buf, "NODES") == 0)
{
ist >> novertex;
PrintMessage(5,"nuber of vertices = ", novertex);
for (i = 0; i < novertex; i++)
{
ist >> px;
ist >> py;
ist >> pz;
readpoints.Append(Point<3> (px,py,pz));
}
}
示例15: Add
void Add (int ind)
{
if (!flags.Test(ind))
{
set.Append (ind);
flags.Set (ind);
}
}