本文整理汇总了C++中MakeCamel函数的典型用法代码示例。如果您正苦于以下问题:C++ MakeCamel函数的具体用法?C++ MakeCamel怎么用?C++ MakeCamel使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MakeCamel函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: BuildFieldOfTable
// Set the value of a table's field.
static void BuildFieldOfTable(const StructDef &struct_def,
const FieldDef &field,
const size_t offset,
std::string *code_ptr) {
std::string &code = *code_ptr;
code += "func " + struct_def.name + "Add" + MakeCamel(field.name);
code += "(builder *flatbuffers.Builder, ";
code += MakeCamel(field.name, false) + " ";
if (!IsScalar(field.value.type.base_type) && (!struct_def.fixed)) {
code += "flatbuffers.UOffsetT";
} else {
code += GenTypeBasic(field.value.type);
}
code += ") {\n";
code += "\tbuilder.Prepend";
code += GenMethod(field) + "Slot(";
code += NumToString(offset) + ", ";
if (!IsScalar(field.value.type.base_type) && (!struct_def.fixed)) {
code += "flatbuffers.UOffsetT";
code += "(";
code += MakeCamel(field.name, false) + ")";
} else {
code += MakeCamel(field.name, false);
}
code += ", " + field.value.constant;
code += ")\n}\n";
}
开发者ID:MinhHTML5,项目名称:FocusFire,代码行数:28,代码来源:idl_gen_go.cpp
示例2: MutateScalarFieldOfStruct
// Mutate the value of a struct's scalar.
static void MutateScalarFieldOfStruct(const StructDef &struct_def,
const FieldDef &field,
std::string *code_ptr) {
std::string &code = *code_ptr;
std::string type = MakeCamel(GenTypeBasic(field.value.type));
std::string setter = "rcv._tab.Mutate" + type;
GenReceiver(struct_def, code_ptr);
code += " Mutate" + MakeCamel(field.name);
code += "(n " + TypeName(field) + ") bool {\n\treturn " + setter;
code += "(rcv._tab.Pos+flatbuffers.UOffsetT(";
code += NumToString(field.value.offset) + "), n)\n}\n\n";
}
开发者ID:MinhHTML5,项目名称:FocusFire,代码行数:13,代码来源:idl_gen_go.cpp
示例3: MutateScalarFieldOfTable
// Mutate the value of a table's scalar.
static void MutateScalarFieldOfTable(const StructDef &struct_def,
const FieldDef &field,
std::string *code_ptr) {
std::string &code = *code_ptr;
std::string type = MakeCamel(GenTypeBasic(field.value.type));
std::string setter = "rcv._tab.Mutate" + type + "Slot";
GenReceiver(struct_def, code_ptr);
code += " Mutate" + MakeCamel(field.name);
code += "(n " + TypeName(field) + ") bool {\n\treturn ";
code += setter + "(" + NumToString(field.value.offset) + ", n)\n";
code += "}\n\n";
}
开发者ID:MinhHTML5,项目名称:FocusFire,代码行数:13,代码来源:idl_gen_go.cpp
示例4: GenGetter
// Returns the function name that is able to read a value of the given type.
static std::string GenGetter(const Type &type) {
switch (type.base_type) {
case BASE_TYPE_STRING: return "rcv._tab.ByteVector";
case BASE_TYPE_UNION: return "rcv._tab.Union";
case BASE_TYPE_VECTOR: return GenGetter(type.VectorType());
default:
return "rcv._tab.Get" + MakeCamel(GenTypeGet(type));
}
}
开发者ID:MinhHTML5,项目名称:FocusFire,代码行数:10,代码来源:idl_gen_go.cpp
示例5: GetStructFieldOfStruct
// Get a struct by initializing an existing struct.
// Specific to Struct.
static void GetStructFieldOfStruct(const StructDef &struct_def,
const FieldDef &field,
std::string *code_ptr) {
std::string &code = *code_ptr;
GenReceiver(struct_def, code_ptr);
code += MakeCamel(field.name);
code += "(self, obj):\n";
code += Indent + Indent + "obj.Init(self._tab.Bytes, self._tab.Pos + ";
code += NumToString(field.value.offset) + ")";
code += "\n" + Indent + Indent + "return obj\n\n";
}
开发者ID:TGIshib,项目名称:flatbuffers,代码行数:13,代码来源:idl_gen_python.cpp
示例6: GetScalarFieldOfStruct
// Get the value of a struct's scalar.
static void GetScalarFieldOfStruct(const StructDef &struct_def,
const FieldDef &field,
std::string *code_ptr) {
std::string &code = *code_ptr;
std::string getter = GenGetter(field.value.type);
GenReceiver(struct_def, code_ptr);
code += " " + MakeCamel(field.name);
code += "() " + TypeName(field) + " { return " + getter;
code += "(rcv._tab.Pos + flatbuffers.UOffsetT(";
code += NumToString(field.value.offset) + ")) }\n";
}
开发者ID:asmodehn,项目名称:flatbuffers,代码行数:12,代码来源:idl_gen_go.cpp
示例7: GetVectorLen
// Get the length of a vector.
static void GetVectorLen(const StructDef &struct_def,
const FieldDef &field,
std::string *code_ptr) {
std::string &code = *code_ptr;
GenReceiver(struct_def, code_ptr);
code += MakeCamel(field.name) + "Length(self";
code += "):" + OffsetPrefix(field);
code += Indent + Indent + Indent + "return self._tab.VectorLen(o)\n";
code += Indent + Indent + "return 0\n\n";
}
开发者ID:TGIshib,项目名称:flatbuffers,代码行数:12,代码来源:idl_gen_python.cpp
示例8: GetVectorLen
// Get the length of a vector.
static void GetVectorLen(const StructDef &struct_def,
const FieldDef &field,
std::string *code_ptr) {
std::string &code = *code_ptr;
GenReceiver(struct_def, code_ptr);
code += " " + MakeCamel(field.name) + "Length(";
code += ") int " + OffsetPrefix(field);
code += "\t\treturn rcv._tab.VectorLen(o)\n\t}\n";
code += "\treturn 0\n}\n\n";
}
开发者ID:MinhHTML5,项目名称:FocusFire,代码行数:12,代码来源:idl_gen_go.cpp
示例9: GetStringField
// Get the value of a string.
static void GetStringField(const StructDef &struct_def,
const FieldDef &field,
std::string *code_ptr) {
std::string &code = *code_ptr;
GenReceiver(struct_def, code_ptr);
code += " " + MakeCamel(field.name);
code += "() " + TypeName(field) + " ";
code += OffsetPrefix(field) + "\t\treturn " + GenGetter(field.value.type);
code += "(o + rcv._tab.Pos)\n\t}\n\treturn nil\n";
code += "}\n\n";
}
开发者ID:MinhHTML5,项目名称:FocusFire,代码行数:12,代码来源:idl_gen_go.cpp
示例10: GetScalarFieldOfStruct
// Get the value of a struct's scalar.
static void GetScalarFieldOfStruct(const StructDef &struct_def,
const FieldDef &field,
std::string *code_ptr) {
std::string &code = *code_ptr;
std::string getter = GenGetter(field.value.type);
GenReceiver(struct_def, code_ptr);
code += MakeCamel(field.name);
code += "(self): return " + getter;
code += "self._tab.Pos + flatbuffers.number_types.UOffsetTFlags.py_type(";
code += NumToString(field.value.offset) + "))\n";
}
开发者ID:TGIshib,项目名称:flatbuffers,代码行数:12,代码来源:idl_gen_python.cpp
示例11: BuildVectorOfTable
// Set the value of one of the members of a table's vector.
static void BuildVectorOfTable(const StructDef &struct_def,
const FieldDef &field,
std::string *code_ptr) {
std::string &code = *code_ptr;
code += "func " + struct_def.name + "Start";
code += MakeCamel(field.name);
code += "Vector(builder *flatbuffers.Builder, numElems int) ";
code += "flatbuffers.UOffsetT { return builder.StartVector(";
code += NumToString(InlineSize(field.value.type.VectorType()));
code += ", numElems) }\n";
}
开发者ID:BlackDragonIX,项目名称:flatbuffers,代码行数:12,代码来源:idl_gen_go.cpp
示例12: GenGetter
// Returns the function name that is able to read a value of the given type.
static std::string GenGetter(const Type &type) {
switch (type.base_type) {
case BASE_TYPE_STRING: return "self._tab.String(";
case BASE_TYPE_UNION: return "self._tab.Union(";
case BASE_TYPE_VECTOR: return GenGetter(type.VectorType());
default:
return "self._tab.Get(flatbuffers.number_types." + \
MakeCamel(GenTypeGet(type)) + \
"Flags, ";
}
}
开发者ID:TGIshib,项目名称:flatbuffers,代码行数:12,代码来源:idl_gen_python.cpp
示例13: GetUByteSlice
// Get a [ubyte] vector as a byte slice.
static void GetUByteSlice(const StructDef &struct_def,
const FieldDef &field,
std::string *code_ptr) {
std::string &code = *code_ptr;
GenReceiver(struct_def, code_ptr);
code += " " + MakeCamel(field.name) + "Bytes(";
code += ") []byte " + OffsetPrefix(field);
code += "\t\treturn rcv._tab.ByteVector(o + rcv._tab.Pos)\n\t}\n";
code += "\treturn nil\n}\n\n";
}
开发者ID:MinhHTML5,项目名称:FocusFire,代码行数:12,代码来源:idl_gen_go.cpp
示例14: GenGetter
// Returns the function name that is able to read a value of the given type.
static std::string GenGetter(const Type &type) {
switch (type.base_type) {
case BASE_TYPE_STRING: return "__string";
case BASE_TYPE_STRUCT: return "__struct";
case BASE_TYPE_UNION: return "__union";
case BASE_TYPE_VECTOR: return GenGetter(type.VectorType());
default:
return "bb.get" + (SizeOf(type.base_type) > 1
? MakeCamel(GenTypeGet(type))
: "");
}
}
开发者ID:dev-life,项目名称:flatbuffers,代码行数:13,代码来源:idl_gen_java.cpp
示例15: GetStringField
// Get the value of a string.
static void GetStringField(const StructDef &struct_def,
const FieldDef &field,
std::string *code_ptr) {
std::string &code = *code_ptr;
GenReceiver(struct_def, code_ptr);
code += MakeCamel(field.name);
code += "(self):";
code += OffsetPrefix(field);
code += Indent + Indent + Indent + "return " + GenGetter(field.value.type);
code += "o + self._tab.Pos)\n";
code += Indent + Indent + "return \"\"\n\n";
}
开发者ID:TGIshib,项目名称:flatbuffers,代码行数:13,代码来源:idl_gen_python.cpp
示例16: GetUnionField
// Get the value of a union from an object.
static void GetUnionField(const StructDef &struct_def,
const FieldDef &field,
std::string *code_ptr) {
std::string &code = *code_ptr;
GenReceiver(struct_def, code_ptr);
code += " " + MakeCamel(field.name) + "(";
code += "obj " + TypeName(field) + ") bool ";
code += OffsetPrefix(field);
code += "\t\t" + GenGetter(field.value.type);
code += "(obj, o)\n\t\treturn true\n\t}\n";
code += "\treturn false\n";
code += "}\n\n";
}
开发者ID:MinhHTML5,项目名称:FocusFire,代码行数:14,代码来源:idl_gen_go.cpp
示例17: BuildVectorOfTable
// Set the value of one of the members of a table's vector.
static void BuildVectorOfTable(const StructDef &struct_def,
const FieldDef &field,
std::string *code_ptr) {
std::string &code = *code_ptr;
code += "def " + struct_def.name + "Start";
code += MakeCamel(field.name);
code += "Vector(builder, numElems): return builder.StartVector(";
auto vector_type = field.value.type.VectorType();
auto alignment = InlineAlignment(vector_type);
auto elem_size = InlineSize(vector_type);
code += NumToString(elem_size);
code += ", numElems, " + NumToString(alignment);
code += ")\n";
}
开发者ID:TGIshib,项目名称:flatbuffers,代码行数:15,代码来源:idl_gen_python.cpp
示例18: GetStructFieldOfStruct
// Get a struct by initializing an existing struct.
// Specific to Struct.
static void GetStructFieldOfStruct(const StructDef &struct_def,
const FieldDef &field,
std::string *code_ptr) {
std::string &code = *code_ptr;
GenReceiver(struct_def, code_ptr);
code += " " + MakeCamel(field.name);
code += "(obj *" + TypeName(field);
code += ") *" + TypeName(field);
code += " {\n";
code += "\tif obj == nil {\n";
code += "\t\tobj = new(" + TypeName(field) + ")\n";
code += "\t}\n";
code += "\tobj.Init(rcv._tab.Bytes, rcv._tab.Pos+";
code += NumToString(field.value.offset) + ")";
code += "\n\treturn obj\n";
code += "}\n";
}
开发者ID:MinhHTML5,项目名称:FocusFire,代码行数:19,代码来源:idl_gen_go.cpp
示例19: GenStructBody
// Recusively generate struct construction statements of the form:
// builder.putType(name);
// and insert manual padding.
static void GenStructBody(const StructDef &struct_def, std::string *code_ptr,
const char *nameprefix) {
std::string &code = *code_ptr;
code += " builder.prep(" + NumToString(struct_def.minalign) + ", 0);\n";
for (auto it = struct_def.fields.vec.rbegin();
it != struct_def.fields.vec.rend();
++it) {
auto &field = **it;
if (field.padding)
code += " builder.pad(" + NumToString(field.padding) + ");\n";
if (IsStruct(field.value.type)) {
GenStructBody(*field.value.type.struct_def, code_ptr,
(field.value.type.struct_def->name + "_").c_str());
} else {
code += " builder.put" + GenMethod(field) + "(";
code += nameprefix + MakeCamel(field.name, false) + ");\n";
}
}
}
开发者ID:Abioy,项目名称:flatbuffers,代码行数:22,代码来源:idl_gen_java.cpp
示例20: GenStructArgs
// Recursively generate arguments for a constructor, to deal with nested
// structs.
static void GenStructArgs(const StructDef &struct_def, std::string *code_ptr,
const char *nameprefix) {
std::string &code = *code_ptr;
for (auto it = struct_def.fields.vec.begin();
it != struct_def.fields.vec.end();
++it) {
auto &field = **it;
if (IsStruct(field.value.type)) {
// Generate arguments for a struct inside a struct. To ensure names
// don't clash, and to make it obvious these arguments are constructing
// a nested struct, prefix the name with the struct name.
GenStructArgs(*field.value.type.struct_def, code_ptr,
(field.value.type.struct_def->name + "_").c_str());
} else {
code += ", " + GenTypeBasic(field.value.type) + " " + nameprefix;
code += MakeCamel(field.name, false);
}
}
}
开发者ID:dev-life,项目名称:flatbuffers,代码行数:21,代码来源:idl_gen_java.cpp
注:本文中的MakeCamel函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论