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


C++ CodeFile类代码示例

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


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

示例1: generateServiceStub

static void generateServiceStub(CodeFile& f, Service* s)
{
	f.output("class %sStub(object):", s->getNameC());
	f.indent();
	for(size_t i = 0; i < s->methods_.size(); i++)
		generateServiceStubMethod(f, s->methods_[i]);
	f.recover();
}
开发者ID:yuanlin2008,项目名称:bintalk,代码行数:8,代码来源:PYGenerator.cpp

示例2: generateEnum

static void generateEnum(CodeFile& f, Enum* e)
{
	f.output("class %s(object):", e->getNameC());
	f.indent();
	for(size_t i = 0; i < e->items_.size(); i++)
		f.output("%s = %d", e->items_[i].c_str(), i);
	f.recover();
}
开发者ID:yuanlin2008,项目名称:bintalk,代码行数:8,代码来源:PYGenerator.cpp

示例3: generateFieldContainerSCode

static void generateFieldContainerSCode(CodeFile& f, FieldContainer* fc)
{
    for (size_t i = 0; i < fc->fields_.size(); i++)
    {
        Field& field = fc->fields_[i];
        if (field.isArray())
            f.output("BTK_Writer.type_array(BTK_Writer.type_%s, v.%s, b)", getFieldTypeName(field), field.getNameC());
        else
            f.output("BTK_Writer.type_%s(v.%s, b)", getFieldTypeName(field), field.getNameC());
    }
}
开发者ID:yuanlin2008,项目名称:bintalk,代码行数:11,代码来源:LUAGenerator.cpp

示例4: generateFieldContainerDSCode

static void generateFieldContainerDSCode(CodeFile& f, FieldContainer* fc)
{
    for (size_t i = 0; i < fc->fields_.size(); i++)
    {
        Field& field = fc->fields_[i];
        if (field.isArray())
            f.output("v.%s, p = BTK_Reader.type_array(b, p, BTK_Reader.type_%s, 0X%X, 0X%X)", field.getNameC(), getFieldTypeName(field), field.maxArray_, field.maxValue_);
        else
            f.output("v.%s, p = BTK_Reader.type_%s(b, p, 0X%X)", field.getNameC(), getFieldTypeName(field), field.maxValue_);
    }
}
开发者ID:yuanlin2008,项目名称:bintalk,代码行数:11,代码来源:LUAGenerator.cpp

示例5: generateProxyAbstractMethod

static void generateProxyAbstractMethod(CodeFile& f, Method& m)
{
	f.listBegin(",", false, "bool %s(", m.getNameC());
	for(size_t i = 0; i < m.fields_.size(); i++)
	{
		Field& field = m.fields_[i];
		std::string tn;
		getFieldTypeName(field, tn); 
		f.listItem("%s %s",tn.c_str(), field.getNameC());
	}
	f.listEnd(");");
}
开发者ID:somylr,项目名称:bintalk,代码行数:12,代码来源:CSGenerator.cpp

示例6: generateFieldSCode

static void generateFieldSCode(CodeFile& f, Field& field)
{
	if(field.isArray())
	{
		f.indent("{");
		f.output("bintalk.ProtocolWriter.writeDynSize(__w__, (uint)%s.Count);", field.getNameC());
		f.output("foreach(%s __vi__ in %s) bintalk.ProtocolWriter.write(__w__, __vi__);",
			getFieldInnerTypeName(field),
			field.getNameC());
		f.recover("}");
	}
	else
		f.output("bintalk.ProtocolWriter.write(__w__, %s);", field.getNameC());
}
开发者ID:somylr,项目名称:bintalk,代码行数:14,代码来源:CSGenerator.cpp

示例7: generateStruct

static void generateStruct(CodeFile& f, Struct* s)
{
    f.output("BTK_Writer.type_%s = function(v, b)", s->getNameC());
    f.indent();
    generateFieldContainerSCode(f, s);
    f.recover();
    f.output("end");

    f.output("BTK_Reader.type_%s = function(b, p)", s->getNameC());
    f.indent();
    f.output("local v = {}");
    generateFieldContainerDSCode(f, s);
    f.output("return v, p");
    f.recover();
    f.output("end");
}
开发者ID:yuanlin2008,项目名称:bintalk,代码行数:16,代码来源:LUAGenerator.cpp

示例8: generateMethodDispatcher

static void generateMethodDispatcher(CodeFile& f, Service* s, Method& m)
{
	f.output("public static bool %s(bintalk.IReader __r__, %sProxy __p__)", m.getNameC(), s->getNameC());
	f.indent("{");
	for(size_t i = 0; i < m.fields_.size(); i++)
	{
		Field& field = m.fields_[i];
		std::string tn;
		getFieldTypeName(field, tn); 
		std::string dft;
		getFieldDefault(field, dft);
		f.output("%s %s= %s;", 
			tn.c_str(),
			field.getNameC(),
			dft.c_str());
	}
	generateFieldContainerDSCode(f, &m);
	f.listBegin(",", false, "return __p__.%s(", m.getNameC());
	for(size_t i = 0; i < m.fields_.size(); i++)
	{
		Field& field = m.fields_[i];
		f.listItem("%s", field.getNameC());
	}
	f.listEnd(");");
	f.recover("}");
}
开发者ID:somylr,项目名称:bintalk,代码行数:26,代码来源:CSGenerator.cpp

示例9: generateFieldDSCode

static void generateFieldDSCode(CodeFile& f, Field& field)
{
	if(field.isArray())
	{
		f.indent("{");
		f.output("uint __s__;");
		f.output("if (!bintalk.ProtocolReader.readDynSize(__r__, out __s__) || __s__ > 0X%X) return false;", field.maxArray_);
		f.output("for(uint __i__ = 0; __i__ < __s__; __i__++)");
		f.indent("{");
		std::string idft;
		getFieldInnerDefault(field, idft);
		f.output("%s __vi__ = %s;", getFieldInnerTypeName(field), idft.c_str());
        f.output("if (!bintalk.ProtocolReader.read(__r__, ref __vi__, 0X%X)) return false;", field.maxValue_);
		f.output("%s.Add(__vi__);", field.getNameC());
		f.recover("}");
		f.recover("}");
	}
	else
		f.output("if(!bintalk.ProtocolReader.read(__r__, ref %s, 0X%X)) return false;", field.getNameC(), field.maxValue_);
}
开发者ID:somylr,项目名称:bintalk,代码行数:20,代码来源:CSGenerator.cpp

示例10: generateServiceDispatcherMethod

static void generateServiceDispatcherMethod(CodeFile& f, Service* s, Method& m)
{
	f.output("def %s_%s(__b__, __p__, __proxy__):", s->getNameC(), m.getNameC());
	f.indent();
	generateFieldContainerDSCode(f, &m, false);
	f.listBegin(",", false, "__proxy__.%s(", m.getNameC());
	for(size_t i = 0; i < m.fields_.size(); i++)
		f.listItem("%s", m.fields_[i].getNameC());
	f.listEnd(")");
	f.output("return __p__");
	f.recover();
	f.output("%sDispatcher.append(%s_%s)", s->getNameC(), s->getNameC(), m.getNameC());
}
开发者ID:yuanlin2008,项目名称:bintalk,代码行数:13,代码来源:PYGenerator.cpp

示例11: generateServiceStubMethod

static void generateServiceStubMethod(CodeFile& f, Method& m)
{
	f.listBegin(",", false, "def %s(", m.getNameC());
	f.listItem("self");
	for(size_t i = 0; i < m.fields_.size(); i++)
	{
		Field& field = m.fields_[i];
		f.listItem("%s", field.getNameC());
	}
	f.listEnd("):");
	f.indent();
	f.output("__b__ = []");
	f.output("protocol_writer.write_mid(%d, __b__)", m.mid_);
	generateFieldContainerSCode(f, &m, false);
	f.output("self.call(__b__)");
	f.recover();
}
开发者ID:yuanlin2008,项目名称:bintalk,代码行数:17,代码来源:PYGenerator.cpp

示例12: generateFieldContainerSCode

static void generateFieldContainerSCode(CodeFile& f, FieldContainer* fc, bool self)
{
	for(size_t i = 0; i < fc->fields_.size(); i++)
	{
		Field& field = fc->fields_[i];
		f.output("protocol_writer.write(protocol_writer.type_%s, %s, %s%s, __b__)",
			getFieldTypeName(field),
			field.isArray()?"True":"False",
			self?"self.":"",
			field.getNameC()
			);
	}
}
开发者ID:yuanlin2008,项目名称:bintalk,代码行数:13,代码来源:PYGenerator.cpp

示例13: generateServiceProxy

static void generateServiceProxy(CodeFile& f, Service* s)
{
	f.output("public enum %sProxyMID", s->getNameC());
	f.indent("{");
	for(size_t i = 0; i < s->methods_.size(); i++)
		f.output("%s,", s->methods_[i].name_.c_str());
	f.recover("}");

	f.output("public interface %sProxy", s->getNameC());
	f.indent("{");
	f.output("bool filterMethod(%sProxyMID mid);", s->getNameC());
	for(size_t i = 0; i < s->methods_.size(); i++)
		generateProxyAbstractMethod(f, s->methods_[i]);
	f.recover("}");
}
开发者ID:somylr,项目名称:bintalk,代码行数:15,代码来源:CSGenerator.cpp

示例14: generateFieldContainerDSCode

static void generateFieldContainerDSCode(CodeFile& f, FieldContainer* fc, bool self)
{
	for(size_t i = 0; i < fc->fields_.size(); i++)
	{
		Field& field = fc->fields_[i];
		f.output("%s%s, __p__= protocol_reader.read(__b__, __p__, protocol_reader.type_%s, 0X%X, 0X%X)",
			self?"self.":"",
			field.getNameC(),
			getFieldTypeName(field),
			field.maxArray_,
			field.maxValue_
			);
	}
}
开发者ID:yuanlin2008,项目名称:bintalk,代码行数:14,代码来源:PYGenerator.cpp

示例15: generateStubMethod

static void generateStubMethod(CodeFile& f, Service* s, Method& m)
{
	f.listBegin(",", false, "public void %s(", m.getNameC());
	for(size_t i = 0; i < m.fields_.size(); i++)
	{
		Field& field = m.fields_[i];
		std::string tn;
		getFieldTypeName(field, tn); 
		f.listItem("%s %s", tn.c_str(), field.getNameC());
	}
	f.listEnd(")");
	f.indent("{");
	f.output("bintalk.IWriter __w__ = methodBegin();");
	f.output("bintalk.ProtocolWriter.writeMid(__w__, %d);", m.mid_);
	generateFieldContainerSCode(f, &m);
	f.output("methodEnd();");
	f.recover("}");
}
开发者ID:somylr,项目名称:bintalk,代码行数:18,代码来源:CSGenerator.cpp


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