本文整理汇总了C++中Content类的典型用法代码示例。如果您正苦于以下问题:C++ Content类的具体用法?C++ Content怎么用?C++ Content使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Content类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
ContentPtr Panel::getContent( const std::string contentID, int& index )
{
for( TabItr i = tabList_.begin(); i != tabList_.end(); ++i )
{
Content* content = (*i)->getContent().getObject();
if ( !content )
continue;
if ( contentID.compare( content->getContentID() ) == 0 )
{
if ( index <= 0 )
return content;
else
index--;
}
else if ( content->getContentID() == ContentContainer::contentID &&
((ContentContainer*)content)->contains( contentID ) )
{
content = ((ContentContainer*)content)->getContent( contentID, index ).getObject();
if ( content )
return content;
// index already decremented by ContentContainer::getContent
}
}
return 0;
}
示例2: createErrorContent
ContentPtr ContentFactory::createErrorContent(const Content& content)
{
const auto& uri = content.getUri();
const auto& size = content.getDimensions();
return std::make_unique<ErrorContent>(uri, size);
}
示例3: main
int main()
{
#if 1
Content * cont; /// < 得到锦囊
cont = new Content(new Backdoor());
cont->operate(); /// < 开后门
delete cont;
cont = new Content(new Greelight());
cont->operate(); /// < 开绿灯
delete cont;
cont = new Content(new BlockEnemy());
cont->operate(); /// < 段后
delete cont;
#endif
cout << "\n------------" << endl;
#if 1
/// < 模板方式
ContentT<Backdoor> contBck;
contBck.operate();
ContentT<Greelight> contGrl;
contGrl.operate();
ContentT<BlockEnemy> contBlk;
contBlk.operate();
#endif
return 0;
}
开发者ID:FanChael,项目名称:cplusplus-version-to-achieve-24-design-patterns-and-six-design-principles-,代码行数:34,代码来源:main.cpp
示例4: create
//method that's called when algorithm is registered
//list input and output datasets here
static Algorithm* create()
{
Content* algo = new Content();
algo->addInputDataset("imagesIn");
algo->addOutputDataset("imagesOut");
return algo;
}
示例5: QPixmap
QPixmap
AtticaManager::iconForResolver( const Content& resolver )
{
if ( !m_resolverStates[ resolver.id() ].pixmap )
return QPixmap();
return *m_resolverStates.value( resolver.id() ).pixmap;
}
示例6: Clear
void Clear()
{
for (Content::iterator it = content_.begin();
it != content_.end(); ++it)
{
delete *it;
}
}
示例7: while
void ChannelPlayerAdapter::createPlayer() {
Player* childPlayer = NULL;
CompositeExecutionObject* cpExObj;
ExecutionObject* childObj;
vector<ExecutionObject*>* objects;
map<string, Player*>* objectMap;
Content* content;
string mrlPlayer;
string selectedObject = "";
cpExObj = (CompositeExecutionObject*)object;
objectMap = new map<string, Player*>;
objects = cpExObj->getExecutionObjects();
if (objects != NULL && cpExObj->getDescriptor() != NULL) {
vector<ExecutionObject*>::iterator i;
i = objects->begin();
while (i != objects->end()) {
childObj = *i;
if (childObj != NULL && childObj->getDataObject() != NULL &&
childObj->getDataObject()->getDataEntity() != NULL &&
((NodeEntity*)(childObj->getDataObject()->
getDataEntity()))->getContent() != NULL) {
content = ((NodeEntity*)(childObj->getDataObject()->
getDataEntity()))->getContent();
if (content->instanceOf("ReferenceContent")) {
mrlPlayer = ((ReferenceContent*)content)->
getCompleteReferenceUrl();
childPlayer = new AVPlayer(mrlPlayer, hasVisual);
(*objectMap)[childObj->
getDataObject()->getId()] = childPlayer;
}
}
++i;
}
//cout << "ChannelPlayerAdapter::createPlayer objMap->size = ";
//cout << objectMap->size() << endl;
selectedObject = cpExObj->getDescriptor()->
getParameterValue("selectedObject");
}
if (objects != NULL) {
delete objects;
objects = NULL;
}
player = new ChannelPlayer(objectMap);
if (selectedObject != "") {
childPlayer = ((ChannelPlayer*)player)->getPlayer(selectedObject);
((ChannelPlayer*)player)->select(childPlayer);
}
FormatterPlayerAdapter::createPlayer();
}
示例8: Remove
void Remove(const std::string& filename)
{
Content::iterator it = Find(filename);
if (it != content_.end())
{
delete *it;
content_.erase(it);
}
}
示例9: tabContains
bool Panel::tabContains( TabPtr t, ContentPtr content )
{
Content* tcontent = t->getContent().getObject();
if ( !tcontent )
return 0;
return tcontent == content ||
( tcontent->getContentID() == ContentContainer::contentID &&
((ContentContainer*)tcontent)->contains( content ) );
}
示例10:
AtticaManager::ResolverState
AtticaManager::resolverState ( const Content& resolver ) const
{
if ( !m_resolverStates.contains( resolver.id() ) )
{
return AtticaManager::Uninstalled;
}
return m_resolverStates[ resolver.id() ].state;
}
示例11: switch
std::unique_ptr<DataSource> DataSourceFactory::create(const Content& content)
{
switch (content.getType())
{
#if TIDE_ENABLE_MOVIE_SUPPORT
case ContentType::movie:
return std::make_unique<MovieUpdater>(content.getUri());
#endif
case ContentType::pixel_stream:
#if TIDE_ENABLE_WEBBROWSER_SUPPORT
case ContentType::webbrowser:
#endif
return std::make_unique<PixelStreamUpdater>(content.getUri());
case ContentType::svg:
return std::make_unique<SVGTiler>(content.getUri(),
content.getMaxDimensions());
case ContentType::image:
return std::make_unique<ImageSource>(content.getUri());
#if TIDE_ENABLE_PDF_SUPPORT
case ContentType::pdf:
return std::make_unique<PDFTiler>(content.getUri(),
content.getMaxDimensions());
#endif
#if TIDE_USE_TIFF
case ContentType::image_pyramid:
return std::make_unique<ImagePyramidDataSource>(content.getUri());
#endif
default:
throw std::logic_error("No data source for this content type");
}
}
示例12: find
void Host::delete_content(int cid){
std::vector<int>::iterator it;
it = find(cids_.begin(), cids_.end(), cid);
if(it!=cids_.begin())
cids_.erase(it);
/* Delete the content file */
Content c;
string filename = c.get_content_name_in_host(id_,cid);
remove(filename.c_str());
}
示例13: checkNode
// 0 -> not valid; 1 -> valid
int Xmlvalidator::checkNode(Item* node) {
Tag* tagNode = dynamic_cast<Tag *>(node);
if (tagNode) {
string name = tagNode->getName();
string transfo = "";
vector<Item *> children = tagNode->getChildren();
for(vector<Item *>::iterator itCh = children.begin(); itCh != children.end(); itCh++) {
Element* elNode = dynamic_cast<Element *>(*itCh);
if (elNode)
{
transfo += "<"+elNode->getName()+">";
}
else
{
Content* ctNode = dynamic_cast<Content *>(*itCh);
if (ctNode)
{
transfo += ctNode->textContent();
}
}
// Recursive call for each children
if (checkNode((*itCh)) == 0)
{
// if it is not valid
return 0;
}
}
std::map<string,string>::iterator itRegex = mapRegex.find(name);
if (itRegex == mapRegex.end())
{
std::map<string,string>::iterator itType = mapType.find(name);
itRegex = mapRegex.find(itType->second);
if (itRegex == mapRegex.end())
{
cerr << "XSD not exhaustive for this xml. Missing regex for the type " << itType->second << endl;
}
}
string regex = itRegex->second;
// cout << "DO THE CHECK " << regex << " on " << transfo << " for the node " << name << endl;
std::regex rx(regex);
return regex_match(transfo.begin(), transfo.end(), rx);
}
return 1;
}
示例14: Find
Content::iterator Find(const std::string& filename)
{
for (Content::iterator it = content_.begin();
it != content_.end(); ++it)
{
if ((*it)->GetFilename() == filename)
{
return it;
}
}
return content_.end();
}
示例15: showTab
void Panel::showTab( const std::string contentID, bool show )
{
for( TabItr i = tabList_.begin(); i != tabList_.end(); ++i )
{
if ( tabContains( *i, contentID ) )
{
showTab( *i, show );
Content* tcontent = (*i)->getContent().getObject();
if ( tcontent && tcontent->getContentID() == ContentContainer::contentID )
((ContentContainer*)tcontent)->currentContent( contentID );
}
}
}