本文整理汇总了C++中Container::Add方法的典型用法代码示例。如果您正苦于以下问题:C++ Container::Add方法的具体用法?C++ Container::Add怎么用?C++ Container::Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Container
的用法示例。
在下文中一共展示了Container::Add方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Interpret_
/**
* Perform an interpret call where we want to return a container that
* contains flattened containers (flattened by 1).
*
* @param environment Not used.
* @param parms The parameters passed to the builtin function.
* @param additional_parameter Not used.
* @return a container of elements.
*
* @version
* - JR Lewis 2012.06.01
* - Initial version.
*/
Element ConcatBuiltinImplementation::Interpret_( Environment& /* environment */
, std::vector<Element> const& parms
, Element const& /* additional_parameter */ )
{
typedef std::vector<Element>::const_iterator Iterator;
Container C;
Iterator iter = parms.begin();
Iterator end = parms.end();
for(; iter != end; ++iter)
{
bool isAContainer = false;
Container current = CastToContainer(*iter, isAContainer);
if (isAContainer)
{
int const NUMBER_OF_ELEMENTS = current.NumberOfElements();
for(int i=0; i<NUMBER_OF_ELEMENTS; ++i)
{
C.Add(current.Get(i));
}
}
else
{
C.Add(*iter);
}
}
return C;
}
示例2: CreateBitmapWindow
static void CreateBitmapWindow(Container& owner, TitleBitmapWindow*& bitmap, /*IceGroupBox*& group,*/ TitleWindow* parent, sdword x, sdword y, udword width, udword height, const char* label)
{
const udword OffsetY = 4; // ### not sure why this is needed
// Create bitmap window
WindowDesc WD;
WD.mParent = parent;
WD.mX = x + GROUP_BOX_BORDER_SIZE;
WD.mY = y + GROUP_BOX_BORDER_SIZE + OffsetY;
WD.mWidth = width;
WD.mHeight = height;
WD.mLabel = "BitmapWindow";
WD.mType = WINDOW_POPUP;
WD.mStyle = WSTYLE_NORMAL;
// ### the better style works but not all pixels get displayed
// WD.mStyle = WSTYLE_CLIENT_EDGES|WSTYLE_STATIC_EDGES;
bitmap = ICE_NEW(TitleBitmapWindow)(WD);
bitmap->SetVisible(true);
bitmap->mMainW = parent;
owner.Add(udword(bitmap));
/* if(0)
{
GroupBoxDesc GBD;
GBD.mParent = parent;
GBD.mX = x;
GBD.mY = y;
GBD.mWidth = width + GROUP_BOX_BORDER_SIZE*2;
GBD.mHeight = height + GROUP_BOX_BORDER_SIZE*2 + OffsetY;
GBD.mLabel = label;
group = ICE_NEW(IceGroupBox)(GBD);
owner.Add(udword(group));
}
else*/
{
EditBoxDesc EBD;
EBD.mParent = parent;
EBD.mX = x;
EBD.mY = y;
EBD.mWidth = width + GROUP_BOX_BORDER_SIZE*2;
EBD.mHeight = height + GROUP_BOX_BORDER_SIZE*2 + OffsetY;
EBD.mLabel = label;
EBD.mFilter = EDITBOX_TEXT;
EBD.mType = EDITBOX_READ_ONLY;
IceEditBox* EB = ICE_NEW(IceEditBox)(EBD);
EB->SetVisible(true);
owner.Add(udword(EB));
}
}
示例3: User
STATUS
UserManager::EnumTableReplyHandler( void*, STATUS ){
UserAccessTableEntry *pRow = (UserAccessTableEntry *)m_pTemp;
User *pUser;
Container *pContainer;
if( m_shouldReinit ){
m_shouldReinit = false;
delete m_pTemp;
return m_pUserTable->Enumerate( &m_pTemp, (pTSCallback_t)METHOD_ADDRESS( UserManager, EnumTableReplyHandler ), NULL );
}
pContainer = new SList;
for( U32 index = 0; index < m_pUserTable->GetNumberOfRows(); index++, pRow++ ){
pUser = new User( GetListenManager() );
pUser->BuildYourselfFromPtsRow( pRow );
pUser->m_pUserManager = this;
pContainer->Add( (CONTAINER_ELEMENT)pUser );
}
AddObjectsIntoManagedObjectsVector( *pContainer );
delete m_pTemp;
delete pContainer;
m_isIniting = m_shouldReinit = false;
SSAPI_TRACE( TRACE_L2, "\nUserManager: ...Done! Objects built: ", GetManagedObjectCount() );
SetIsReadyToServiceRequests( true );
return OK;
}
示例4: kv
void PropertyRestrictions<Key, KeyValue, Container>::ConfigureFromJsonAndKey( const Configuration * inputJson, const std::string& key )
{
// Make this optional.
if( inputJson->Exist( key ) == false )
{
return;
}
// We have a list of json objects. The format/logic is as follows. For input:
// [
// { "Character": "Good", "Income": "High" },
// { "Character": "Bad", "Income": "Low" }
// ]
// We give the intervention if the individuals has
// Good Character AND High Income OR Bad Character AND Low Income.
// So we AND together the elements of each json object and OR together these
// calculated truth values of the elements of the json array.
json::QuickInterpreter s2sarray = (*inputJson)[key].As<json::Array>();
for( int idx=0; idx < (*inputJson)[key].As<json::Array>().Size(); idx++ )
{
Container container;
auto json_map = s2sarray[idx].As<json::Object>();
for( auto data = json_map.Begin();
data != json_map.End();
++data )
{
std::string key = data->name;
std::string value = (std::string)s2sarray[idx][key].As< json::String >();
KeyValue kv( key, value );
container.Add( kv );
}
_restrictions.push_back( container );
}
}
示例5: InterpretParsed_
/**
* The following method takes the path and elements passed in and creates a
* new ExecutorProcess_ element that will be in charge of running the
* program.
*
* @version
* - JR Lewis 2012.03.05
* - Initial version.
*/
Element ExecutorBuiltinImplementation::InterpretParsed_( Environment& environment
, Element& path_element
, std::vector<Element> const& parms)
{
String_* path = dynamic_cast<String_*>(path_element.ElementHandle());
Element out;
std::vector<Element> parameters;
Funcall_::InterpretParameters( environment
, parms
, parameters );
if ( 0 != path )
{
Container container;
size_t const PARMS_SIZE = parameters.size();
for(size_t i=0; i<PARMS_SIZE; ++i)
{
container.Add(parameters[i]);
}
ExecutorProcessing_* processing = new ExecutorProcessing_( this->strine
, QString::fromStdString(path->Value())
, container);
out = Processing(processing);
}
return out;
}
示例6: InterpretContainer_
Element InterpretContainer_( Container container
, Environment&
, std::vector<Element> const& elements)
{
Container newContainer = container.Copy();
size_t const SIZE = elements.size();
for(size_t i=0; i<SIZE; ++i)
{
newContainer.Add(elements[i]);
}
return newContainer;
}
示例7: Interpret_
Element FileAttributesBuiltinImplementation::Interpret_( Environment&
, std::vector<strine::Element> const& parms
, Element const& )
{
Container out;
QString filename;
if (1 >= parms.size())
{
bool success = false;
String s = CastToString(parms[0], success);
if (success)
{
filename = QString::fromStdString(s.Value());
}
}
QFileInfo fileInfo(filename);
if (fileInfo.isReadable())
{
out.Add(String("read"));
}
if (fileInfo.isWritable())
{
out.Add(String("write"));
}
if (fileInfo.isExecutable())
{
out.Add(String("execute"));
}
if (fileInfo.isDir())
{
out.Add(String("directory"));
}
if (fileInfo.isHidden())
{
out.Add(String("hidden"));
}
if (fileInfo.isSymLink())
{
out.Add(String("link"));
}
out.Add(String(fileInfo.owner().toStdString()));
return out;
}
示例8: _UnboundedStab
void RayCollider::_UnboundedStab(const AABBTreeNode* node, Container& box_indices)
{
// Test the box against the ray
Point Center, Extents;
node->GetAABB()->GetCenter(Center);
node->GetAABB()->GetExtents(Extents);
if(!RayAABBOverlap(Center, Extents)) return;
if(node->IsLeaf())
{
box_indices.Add(node->GetPrimitives(), node->GetNbPrimitives());
}
else
{
_UnboundedStab(node->GetPos(), box_indices);
_UnboundedStab(node->GetNeg(), box_indices);
}
}
示例9:
void
StorageElementArray::ReportYourUnderlyingDevices( Container &devices ){
SList tempContainer;
StorageElement *pElement;
U32 index;
DesignatorId *pId;
devices.RemoveAll();
for( index = 0 ; index < GetChildCount(); index++ ){
// request a list for every child
pElement = (StorageElement *)GetChild( index );
pElement->ReportYourUnderlyingDevices( tempContainer );
// move ids into the main vector
while( tempContainer.Count() ){
tempContainer.GetAt( (CONTAINER_ELEMENT &)pId, 0 );
tempContainer.RemoveAt( 0 );
devices.Add( (CONTAINER_ELEMENT) pId );
}
}
}