当前位置: 首页>>代码示例>>C++>>正文


C++ Namespace类代码示例

本文整理汇总了C++中Namespace的典型用法代码示例。如果您正苦于以下问题:C++ Namespace类的具体用法?C++ Namespace怎么用?C++ Namespace使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Namespace类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Namespace

Namespace *SKS::GetNamespace(Position &pos, bool noName)
{
	Namespace *name = new Namespace();
	if(!noName)
		name->SetName(GetName(pos));

	while(true)
	{
		if(islineEndOfFile(pos))
		{
			break;
		}
		SkipComment(pos);
		if(isLineNamespaceEnd(pos))
		{
			ExitNamespace(pos);
			break;
		}
		else if(isLineNamespace(pos))
		{
			name->AddNamespace(GetNamespace(pos));
		}
		else if(isLineKeyValue(pos))
		{
			name->AddKeyValue(GetKeyValue(pos));
		}
		else
			break;
	}
	return name;
}
开发者ID:Jonathan-Hamberg,项目名称:SKS,代码行数:31,代码来源:SKS.cpp

示例2: generate_inline

void
generate_inline (Context& ctx, SemanticGraph::Schema& schema, bool i)
{
    Traversal::Schema traverser;
    Traversal::Sources sources;
    Traversal::Names schema_names;
    Namespace ns (ctx);

    traverser.edge_traverser (sources);
    traverser.edge_traverser (schema_names);
    sources.node_traverser (traverser);
    schema_names.node_traverser (ns);

    Traversal::Names names;
    AnonymousType anonymous_type (ctx, i);
    Complex complex (ctx, anonymous_type, i);
    Enumeration enumeration (ctx, i);

    ns.edge_traverser (names);

    names.node_traverser (complex);
    names.node_traverser (enumeration);
    names.node_traverser (anonymous_type);

    traverser.traverse (schema);
}
开发者ID:jwillemsen,项目名称:XSC,代码行数:26,代码来源:Inline.cpp

示例3: if

Namespace& Namespace::walkTo(const string& path, bool create)
{
    size_t sepPos = path.find("::");
    pair<string, string> pathParts;
    if (sepPos == 0)
    {
        string relativePath = path.substr(2, path.length());
        return Register::getSingleton().walkTo(relativePath, create);
    }
    else if (path == "")
        return *this;
    else if (sepPos != string::npos)
        pathParts = splitName(path, NameHead);
    else
        pathParts = make_pair<string, string>(path.c_str(), "");

    try {
        Namespace& ns = getItem_<Namespace>(pathParts.first);
        return ns.walkTo(pathParts.second, create);
    } catch (NotFoundException& e) {
        if (create)
        {
            Namespace* ns = new Namespace(pathParts.first, *this);
            items_.insert(ns);
            ownItems_.insert(ns);
            return ns->walkTo(pathParts.second, create);
        }
        else
        {
            throw e;
        }
    }
}
开发者ID:gaurav1981,项目名称:eXtendedMirror,代码行数:33,代码来源:Namespace.cpp

示例4: namespaceGetNamespacesCallback

 static void namespaceGetNamespacesCallback( const Namespace& k , NamespaceDetails& v , list<string>* l ) {
     if ( ! k.hasDollarSign() || k == "local.oplog.$main" ) {
         // we call out local.oplog.$main specifically as its the only "normal"
         // collection that has a $, so we make sure it gets added
         l->push_back( k.toString() );
     }
 }
开发者ID:DieterLutz,项目名称:mongo,代码行数:7,代码来源:namespace_index.cpp

示例5: generate_forward

void
generate_forward (Context& ctx, SemanticGraph::Schema& schema)
{
  ctx.os << "// Forward declarations." << endl;

  Traversal::Schema traverser;
  Traversal::Sources sources;
  Traversal::Names schema_names;
  Namespace ns (ctx);

  traverser.edge_traverser (sources);
  traverser.edge_traverser (schema_names);
  sources.node_traverser (traverser);
  schema_names.node_traverser (ns);

  Traversal::Names names;
  Complex complex (ctx);
  Enumeration enumeration (ctx);

  ns.edge_traverser (names);
  names.node_traverser (complex);
  names.node_traverser (enumeration);

  traverser.traverse (schema);
}
开发者ID:DOCGroup,项目名称:XSC,代码行数:25,代码来源:Forward.cpp

示例6: linkNamespaces

bool linkNamespaces(const char *parent, const char *child)
{
   Namespace *pns = lookupNamespace(parent);
   Namespace *cns = lookupNamespace(child);
   if(pns && cns)
      return cns->classLinkTo(pns);
   return false;
}
开发者ID:Adhdcrazzy,项目名称:Torque3D,代码行数:8,代码来源:console.cpp

示例7: rDebug

void Namespace::ensureNoConflicts(const scene::INodePtr& root)
{
    // Instantiate a new, temporary namespace for the nodes below root
    Namespace foreignNamespace;

    // Move all nodes below (and including) root into this temporary namespace
    foreignNamespace.connect(root);

    // Collect all namespaced items from the foreign root
    GatherNamespacedWalker walker;
    root->traverse(walker);

    rDebug() << "Namespace::ensureNoConflicts(): imported set of "
             << walker.result.size() << " namespaced nodes" << std::endl;

    // Build a union set containing all imported names and all existing names.
    // We need to know all existing names to ensure that newly created names are
    // unique in *both* namespaces
    UniqueNameSet allNames = _uniqueNames;
    allNames.merge(foreignNamespace._uniqueNames);

    // Process each object in the to-be-imported tree of nodes, ensuring that it
    // has a unique name
    for (const NamespacedPtr& n : walker.result)
    {
        // If the imported node conflicts with a name in THIS namespace, then it
        // needs to be given a new name which is unique in BOTH namespaces.
        if (_uniqueNames.nameExists(n->getName()))
        {
            // Name exists in the target namespace, get a new name
            std::string uniqueName = allNames.insertUnique(n->getName());

            rMessage() << "Namespace::ensureNoConflicts(): '" << n->getName()
                       << "' already exists in this namespace. Rename it to '"
                       << uniqueName << "'\n";

            // Change the name of the imported node, this should trigger all
            // observers in the foreign namespace
            n->changeName(uniqueName);
        }
        else
        {
            // Name does not exist yet, insert it into the local combined
            // namespace (but not our destination namespace, this will be
            // populated in the subsequent call to connect()).
            allNames.insert(n->getName());
        }
    }

    // at this point, all names in the foreign namespace have been converted to
    // something unique in this namespace. The calling code can now move the
    // nodes into this namespace without name conflicts

    // Disconnect the root from the foreign namespace again, it will be destroyed now
    foreignNamespace.disconnect(root);
}
开发者ID:BielBdeLuna,项目名称:DarkRadiant,代码行数:56,代码来源:Namespace.cpp

示例8: if

 bool ObjectNamespace::setAttrIfHas(const std::string& attr, Object* obj) {
     if (dict["__inner__"]->dict.find(attr) != dict.end()) {
         dict[attr]->setAttr(attr, obj);
         return true;
     } else if (dict["__parent__"].ref_not_equal(nullptr)) {
         Namespace* parent = ToolKit::SafeConvert<Namespace>(dict["__parent__"].GetPtr());
         return parent->setAttrIfHas(attr, obj);
     } else
         return false;
 }
开发者ID:codewdy,项目名称:ST,代码行数:10,代码来源:Namespace.cpp

示例9: prewalk

void Doclet::prewalk(Namespace& instance)
{
  std::string namespaceName = instance.getName();

  if (instance.hasDocumentation()) {
    Documentation* documentation = instance.getDocumentation();
    if (documentation->containsAnnotation("@prototype") || documentation->containsAnnotation("@prototyped")) {
    }
  }

  typedef std::vector <Include*>::iterator IncludeIterType;
  for (IncludeIterType iter = instance.getIncludes().begin(); iter != instance.getIncludes().end(); iter++) {
    prewalk(**iter);
  }

  typedef std::vector <Class*>::iterator ClassIterType;
  for (ClassIterType iter = instance.getClasses().begin(); iter != instance.getClasses().end(); iter++) {
    prewalk(**iter);
  }

  typedef std::vector <Namespace*>::iterator NamespaceIterType;
  for (NamespaceIterType iter = instance.getNamespaces().begin(); iter != instance.getNamespaces().end(); iter++) {
    prewalk(**iter);
  }

}
开发者ID:williamwaterson,项目名称:protolayer,代码行数:26,代码来源:Doclet.cpp

示例10: Namespace

std::unique_ptr<Node> Namespace::clone() const {
    Namespace* ns = new Namespace();
    ns->lineNumber = lineNumber;
    ns->columnNumber = columnNumber;
    ns->comment = comment;
    ns->namespacePrefix = namespacePrefix;
    ns->namespaceUri = namespaceUri;
    for (auto& child : children) {
        ns->addChild(child->clone());
    }
    return std::unique_ptr<Node>(ns);
}
开发者ID:OchSept,项目名称:platform_frameworks_base,代码行数:12,代码来源:XmlDom.cpp

示例11: EscapeString

  void XmlWriter::WriteNamespace(const Namespace& rNamespace)
  {
    if (rNamespace.GetPrefix().empty())
    {
      m_rStream << " xmlns";
    }
    else
    {
      m_rStream << " xmlns:" << rNamespace.GetPrefix();
    }

    m_rStream << "=\"" << EscapeString(rNamespace.GetUri()) << "\"";
  }
开发者ID:AmesianX,项目名称:staff,代码行数:13,代码来源:XmlWriter.cpp

示例12: generate_writer_header

void
generate_writer_header (Context& ctx, SemanticGraph::Schema& schema)
{
  ctx.os << "#include \"XMLSchema/Writer.hpp\"" << endl
         << endl;

  {
    Traversal::Schema traverser;
    Traversal::Sources sources;
    Traversal::Names schema_names;
    WriterNamespace ns (ctx);

    traverser.edge_traverser (sources);
    traverser.edge_traverser (schema_names);
    sources.node_traverser (traverser);
    schema_names.node_traverser (ns);

    Traversal::Names names;
    AnonymousType anonymous_type (ctx);
    Complex complex (ctx, anonymous_type);
    Enumeration enumeration (ctx);

    ns.edge_traverser (names);
    names.node_traverser (complex);
    names.node_traverser (enumeration);
    names.node_traverser (anonymous_type);

    traverser.traverse (schema);
  }


  {
    Traversal::Schema traverser;
    Traversal::Sources sources;
    Traversal::Names schema_names;
    Namespace ns (ctx);

    traverser.edge_traverser (sources);
    traverser.edge_traverser (schema_names);
    sources.node_traverser (traverser);
    schema_names.node_traverser (ns);

    Traversal::Names names;
    Element element (ctx);
    ns.edge_traverser (names);
    names.node_traverser (element);

    traverser.traverse (schema);
  }
}
开发者ID:SEDS,项目名称:XSC,代码行数:50,代码来源:WriterHeader.cpp

示例13: clang_createIndex

void ReflectionParser::Parse(void)
{
    m_index = clang_createIndex( true, m_options.displayDiagnostics );

    std::vector<const char *> arguments;

#if defined(SYSTEM_INCLUDE_DIRECTORY)

    arguments.emplace_back( "-I" SYSTEM_INCLUDE_DIRECTORY );

#endif

    for (auto &argument : m_options.arguments)
        arguments.emplace_back( argument.c_str( ) );

    if (m_options.displayDiagnostics)
    {
        for (auto *argument : arguments)
            std::cout << argument << std::endl;
    }

    m_translationUnit = clang_createTranslationUnitFromSourceFile(
        m_index,
        m_options.inputSourceFile.c_str( ),
        static_cast<int>( arguments.size( ) ),
        arguments.data( ),
        0,
        nullptr
    );

    auto cursor = clang_getTranslationUnitCursor( m_translationUnit );

    Namespace tempNamespace;

    buildClasses( cursor, tempNamespace );

    tempNamespace.clear( );

    buildGlobals( cursor, tempNamespace );

    tempNamespace.clear( );

    buildGlobalFunctions( cursor, tempNamespace );

    tempNamespace.clear( );

    buildEnums( cursor, tempNamespace );
}
开发者ID:fspadoni,项目名称:CPP-Reflection,代码行数:48,代码来源:ReflectionParser.cpp

示例14: unlinkNamespaces

bool unlinkNamespaces(const char *parent, const char *child)
{
   Namespace *pns = lookupNamespace(parent);
   Namespace *cns = lookupNamespace(child);

   if(pns == cns)
   {
      Con::warnf("Con::unlinkNamespaces - trying to unlink '%s' from itself, aborting.", parent);
      return false;
   }

   if(pns && cns)
      return cns->unlinkClass(pns);

   return false;
}
开发者ID:Adhdcrazzy,项目名称:Torque3D,代码行数:16,代码来源:console.cpp

示例15:

void fluidinfo::Namespace::getSubNamespaceInfo(const std::string& path, Namespace& ns, Session& session, bool returnDescription, bool returnTags, bool returnNamespaces)
{

	ns.setParentSession(&session);
    ns.init();

    string url = ns.mainURL;

    std::string returndesc = ( (returnDescription==false) ? "False" : "True" );
    std::string returntags = ( (returnTags == false) ? "False" : "True" );
    std::string returnnamespaces = ( (returnNamespaces == false) ? "False" : "True" );

    url = url + path + "?returnDescription=" + returndesc + "&returnNamespaces=" + returnnamespaces + "&returnTags=" + returntags;

    ns.runCURL(GET, url, NULL, FWgetSubNamespaceInfo, const_cast<Namespace*>(&ns));
}
开发者ID:npetrovi,项目名称:fluidcpp,代码行数:16,代码来源:fluid_ns.cpp


注:本文中的Namespace类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。