本文整理汇总了C++中deSerializeString函数的典型用法代码示例。如果您正苦于以下问题:C++ deSerializeString函数的具体用法?C++ deSerializeString怎么用?C++ deSerializeString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了deSerializeString函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: readU8
void ContentFeatures::deSerialize(std::istream &is)
{
int version = readU8(is);
if(version != 5)
throw SerializationError("unsupported ContentFeatures version");
name = deSerializeString(is);
groups.clear();
u32 groups_size = readU16(is);
for(u32 i=0; i<groups_size; i++){
std::string name = deSerializeString(is);
int value = readS16(is);
groups[name] = value;
}
drawtype = (enum NodeDrawType)readU8(is);
visual_scale = readF1000(is);
if(readU8(is) != 6)
throw SerializationError("unsupported tile count");
for(u32 i=0; i<6; i++)
tiledef[i].deSerialize(is);
if(readU8(is) != CF_SPECIAL_COUNT)
throw SerializationError("unsupported CF_SPECIAL_COUNT");
for(u32 i=0; i<CF_SPECIAL_COUNT; i++)
tiledef_special[i].deSerialize(is);
alpha = readU8(is);
post_effect_color.setAlpha(readU8(is));
post_effect_color.setRed(readU8(is));
post_effect_color.setGreen(readU8(is));
post_effect_color.setBlue(readU8(is));
param_type = (enum ContentParamType)readU8(is);
param_type_2 = (enum ContentParamType2)readU8(is);
is_ground_content = readU8(is);
light_propagates = readU8(is);
sunlight_propagates = readU8(is);
walkable = readU8(is);
pointable = readU8(is);
diggable = readU8(is);
climbable = readU8(is);
buildable_to = readU8(is);
deSerializeString(is); // legacy: used to be metadata_name
liquid_type = (enum LiquidType)readU8(is);
liquid_alternative_flowing = deSerializeString(is);
liquid_alternative_source = deSerializeString(is);
liquid_viscosity = readU8(is);
light_source = readU8(is);
damage_per_second = readU32(is);
node_box.deSerialize(is);
selection_box.deSerialize(is);
legacy_facedir_simple = readU8(is);
legacy_wallmounted = readU8(is);
deSerializeSimpleSoundSpec(sound_footstep, is);
deSerializeSimpleSoundSpec(sound_dig, is);
deSerializeSimpleSoundSpec(sound_dug, is);
// If you add anything here, insert it primarily inside the try-catch
// block to not need to increase the version.
try{
// Stuff below should be moved to correct place in a version that
// otherwise changes the protocol version
liquid_renewable = readU8(is);
}catch(SerializationError &e) {};
}
开发者ID:derekdreery,项目名称:minetest,代码行数:60,代码来源:nodedef.cpp
示例2: readU8
void ObjectProperties::deSerialize(std::istream &is)
{
int version = readU8(is);
if(version != 1) throw SerializationError(
"unsupported ObjectProperties version");
hp_max = readS16(is);
physical = readU8(is);
weight = readF1000(is);
collisionbox.MinEdge = readV3F1000(is);
collisionbox.MaxEdge = readV3F1000(is);
visual = deSerializeString(is);
visual_size = readV2F1000(is);
textures.clear();
u32 texture_count = readU16(is);
for(u32 i=0; i<texture_count; i++){
textures.push_back(deSerializeString(is));
}
spritediv = readV2S16(is);
initial_sprite_basepos = readV2S16(is);
is_visible = readU8(is);
makes_footstep_sound = readU8(is);
try{
automatic_rotate = readF1000(is);
}catch(SerializationError &e){}
}
开发者ID:AMDmi3,项目名称:minetest,代码行数:25,代码来源:object_properties.cpp
示例3: is
ServerActiveObject* FallingSAO::create(ServerEnvironment *env, v3f pos,
const std::string &data)
{
std::string name;
std::string state;
s16 hp = 1;
v3f velocity;
float yaw = 0;
if(data != "") {
std::istringstream is(data, std::ios::binary);
// read version
u8 version = readU8(is);
// check if version is supported
if(version == 0){
name = deSerializeString(is);
state = deSerializeLongString(is);
}
else if(version == 1){
name = deSerializeString(is);
state = deSerializeLongString(is);
hp = readS16(is);
velocity = readV3F1000(is);
yaw = readF1000(is);
}
}
// create object
//infostream<<"FallingSAO::create(name='%s' state='%s')", name.c_str(), state.c_str();
epixel::FallingSAO *sao = new epixel::FallingSAO(env, pos, name, state);
sao->m_hp = hp;
sao->m_velocity = velocity;
sao->m_yaw = yaw;
return sao;
}
开发者ID:ChunHungLiu,项目名称:freeminer,代码行数:33,代码来源:fallingsao.cpp
示例4: deSerialize
void deSerialize(std::istream &is)
{
// Clear everything
clear();
// Deserialize
int version = readU8(is);
if(version != 0)
throw SerializationError("unsupported ItemDefManager version");
u16 count = readU16(is);
for(u16 i=0; i<count; i++)
{
// Deserialize a string and grab an ItemDefinition from it
std::istringstream tmp_is(deSerializeString(is), std::ios::binary);
ItemDefinition def;
def.deSerialize(tmp_is);
// Register
registerItem(def);
}
u16 num_aliases = readU16(is);
for(u16 i=0; i<num_aliases; i++)
{
std::string name = deSerializeString(is);
std::string convert_to = deSerializeString(is);
registerAlias(name, convert_to);
}
}
开发者ID:EXio4,项目名称:minetest,代码行数:26,代码来源:itemdef.cpp
示例5: is
ServerActiveObject* LuaEntitySAO::create(ServerEnvironment *env, v3f pos,
const std::string &data)
{
std::string name;
std::string state;
s16 hp = 1;
v3f velocity;
float yaw = 0;
if(data != ""){
std::istringstream is(data, std::ios::binary);
// read version
u8 version = readU8(is);
// check if version is supported
if(version == 0){
name = deSerializeString(is);
state = deSerializeLongString(is);
}
else if(version == 1){
name = deSerializeString(is);
state = deSerializeLongString(is);
hp = readS16(is);
velocity = readV3F1000(is);
yaw = readF1000(is);
}
}
// create object
infostream<<"LuaEntitySAO::create(name=\""<<name<<"\" state=\""
<<state<<"\")"<<std::endl;
LuaEntitySAO *sao = new LuaEntitySAO(env, pos, name, state);
sao->m_hp = hp;
sao->m_velocity = velocity;
sao->m_yaw = yaw;
return sao;
}
开发者ID:t0suj4,项目名称:minetest,代码行数:34,代码来源:content_sao.cpp
示例6: readU8
void ToolCapabilities::deSerialize(std::istream &is)
{
int version = readU8(is);
if(version != 1 && version != 2) throw SerializationError(
"unsupported ToolCapabilities version");
full_punch_interval = readF1000(is);
max_drop_level = readS16(is);
groupcaps.clear();
u32 groupcaps_size = readU32(is);
for(u32 i=0; i<groupcaps_size; i++){
std::string name = deSerializeString(is);
ToolGroupCap cap;
cap.uses = readS16(is);
cap.maxlevel = readS16(is);
u32 times_size = readU32(is);
for(u32 i=0; i<times_size; i++){
int level = readS16(is);
float time = readF1000(is);
cap.times[level] = time;
}
groupcaps[name] = cap;
}
if(version == 2)
{
u32 damage_groups_size = readU32(is);
for(u32 i=0; i<damage_groups_size; i++){
std::string name = deSerializeString(is);
s16 rating = readS16(is);
damageGroups[name] = rating;
}
}
}
开发者ID:0gb-us,项目名称:minetest,代码行数:32,代码来源:tool.cpp
示例7: deSerializeString
void CraftDefinitionCooking::deSerializeBody(std::istream &is, int version)
{
if(version != 1) throw SerializationError(
"unsupported CraftDefinitionCooking version");
output = deSerializeString(is);
recipe = deSerializeString(is);
cooktime = readF1000(is);
replacements.deSerialize(is);
}
开发者ID:AMDmi3,项目名称:minetest,代码行数:9,代码来源:craftdef.cpp
示例8: deSerializeString
void ContentFeatures::deSerializeOld(std::istream &is, int version)
{
if(version == 5) // In PROTOCOL_VERSION 13
{
name = deSerializeString(is);
groups.clear();
u32 groups_size = readU16(is);
for(u32 i=0; i<groups_size; i++){
std::string name = deSerializeString(is);
int value = readS16(is);
groups[name] = value;
}
drawtype = (enum NodeDrawType)readU8(is);
visual_scale = readF1000(is);
if(readU8(is) != 6)
throw SerializationError("unsupported tile count");
for(u32 i=0; i<6; i++)
tiledef[i].deSerialize(is);
if(readU8(is) != CF_SPECIAL_COUNT)
throw SerializationError("unsupported CF_SPECIAL_COUNT");
for(u32 i=0; i<CF_SPECIAL_COUNT; i++)
tiledef_special[i].deSerialize(is);
alpha = readU8(is);
post_effect_color.setAlpha(readU8(is));
post_effect_color.setRed(readU8(is));
post_effect_color.setGreen(readU8(is));
post_effect_color.setBlue(readU8(is));
param_type = (enum ContentParamType)readU8(is);
param_type_2 = (enum ContentParamType2)readU8(is);
is_ground_content = readU8(is);
light_propagates = readU8(is);
sunlight_propagates = readU8(is);
walkable = readU8(is);
pointable = readU8(is);
diggable = readU8(is);
climbable = readU8(is);
buildable_to = readU8(is);
deSerializeString(is); // legacy: used to be metadata_name
liquid_type = (enum LiquidType)readU8(is);
liquid_alternative_flowing = deSerializeString(is);
liquid_alternative_source = deSerializeString(is);
liquid_viscosity = readU8(is);
light_source = readU8(is);
damage_per_second = readU32(is);
node_box.deSerialize(is);
selection_box.deSerialize(is);
legacy_facedir_simple = readU8(is);
legacy_wallmounted = readU8(is);
deSerializeSimpleSoundSpec(sound_footstep, is);
deSerializeSimpleSoundSpec(sound_dig, is);
deSerializeSimpleSoundSpec(sound_dug, is);
}
else
{
throw SerializationError("unsupported ContentFeatures version");
}
}
开发者ID:BobMikfillin,项目名称:minetest,代码行数:57,代码来源:nodedef.cpp
示例9: reset
void ItemDefinition::deSerialize(std::istream &is)
{
// Reset everything
reset();
// Deserialize
int version = readU8(is);
if(version < 1 || version > 3)
throw SerializationError("unsupported ItemDefinition version");
type = (enum ItemType)readU8(is);
name = deSerializeString(is);
description = deSerializeString(is);
inventory_image = deSerializeString(is);
wield_image = deSerializeString(is);
wield_scale = readV3F1000(is);
stack_max = readS16(is);
usable = readU8(is);
liquids_pointable = readU8(is);
std::string tool_capabilities_s = deSerializeString(is);
if(!tool_capabilities_s.empty())
{
std::istringstream tmp_is(tool_capabilities_s, std::ios::binary);
tool_capabilities = new ToolCapabilities;
tool_capabilities->deSerialize(tmp_is);
}
groups.clear();
u32 groups_size = readU16(is);
for(u32 i=0; i<groups_size; i++){
std::string name = deSerializeString(is);
int value = readS16(is);
groups[name] = value;
}
if(version == 1){
// We cant be sure that node_placement_prediction is send in version 1
try{
node_placement_prediction = deSerializeString(is);
}catch(SerializationError &e) {};
// Set the old default sound
sound_place.name = "default_place_node";
sound_place.gain = 0.5;
} else if(version >= 2) {
node_placement_prediction = deSerializeString(is);
//deserializeSimpleSoundSpec(sound_place, is);
sound_place.name = deSerializeString(is);
sound_place.gain = readF1000(is);
}
if(version == 3) {
range = readF1000(is);
}
// If you add anything here, insert it primarily inside the try-catch
// block to not need to increase the version.
try {
sound_place_failed.name = deSerializeString(is);
sound_place_failed.gain = readF1000(is);
} catch(SerializationError &e) {};
}
开发者ID:grigoriis,项目名称:MultiCraft,代码行数:56,代码来源:itemdef.cpp
示例10: readU8
void CraftDefinition::deSerialize(std::istream &is)
{
int version = readU8(is);
if(version != 0) throw SerializationError(
"unsupported CraftDefinition version");
output = deSerializeString(is);
input.width = readU8(is);
u32 count = readU16(is);
for(u32 i=0; i<count; i++)
input.items.push_back(deSerializeString(is));
}
开发者ID:Neear,项目名称:minetest,代码行数:11,代码来源:craftdef.cpp
示例11: readU16
void CraftReplacements::deSerialize(std::istream &is)
{
pairs.clear();
u32 count = readU16(is);
for(u32 i=0; i<count; i++)
{
std::string first = deSerializeString(is);
std::string second = deSerializeString(is);
pairs.push_back(std::make_pair(first, second));
}
}
开发者ID:AMDmi3,项目名称:minetest,代码行数:11,代码来源:craftdef.cpp
示例12: is
bool DecoSchematic::loadSchematicFile() {
std::ifstream is(filename.c_str(), std::ios_base::binary);
u32 signature = readU32(is);
if (signature != MTSCHEM_FILE_SIGNATURE) {
errorstream << "loadSchematicFile: invalid schematic "
"file" << std::endl;
return false;
}
u16 version = readU16(is);
if (version != 1) {
errorstream << "loadSchematicFile: unsupported schematic "
"file version" << std::endl;
return false;
}
size = readV3S16(is);
int nodecount = size.X * size.Y * size.Z;
u16 nidmapcount = readU16(is);
node_names = new std::vector<std::string>;
for (int i = 0; i != nidmapcount; i++) {
std::string name = deSerializeString(is);
node_names->push_back(name);
}
delete schematic;
schematic = new MapNode[nodecount];
MapNode::deSerializeBulk(is, SER_FMT_VER_HIGHEST, schematic,
nodecount, 2, 2, true);
return true;
}
开发者ID:MasterCrank,项目名称:minetest,代码行数:35,代码来源:mapgen.cpp
示例13: deSerialize
void deSerialize(std::istream &is)
{
clear();
int version = readU8(is);
if(version != 1)
throw SerializationError("unsupported NodeDefinitionManager version");
u16 count = readU16(is);
std::istringstream is2(deSerializeLongString(is), std::ios::binary);
for(u16 n=0; n<count; n++){
u16 i = readU16(is2);
if(i > MAX_CONTENT){
errorstream<<"ContentFeatures::deSerialize(): "
<<"Too large content id: "<<i<<std::endl;
continue;
}
/*// Do not deserialize special types
if(i == CONTENT_IGNORE || i == CONTENT_AIR)
continue;*/
ContentFeatures *f = &m_content_features[i];
// Read it from the string wrapper
std::string wrapper = deSerializeString(is2);
std::istringstream wrapper_is(wrapper, std::ios::binary);
f->deSerialize(wrapper_is);
verbosestream<<"deserialized "<<f->name<<std::endl;
if(f->name != "")
addNameIdMapping(i, f->name);
}
}
开发者ID:ajbetteridge,项目名称:minetest,代码行数:28,代码来源:nodedef.cpp
示例14: readU8
void TileDef::deSerialize(std::istream &is, u8 contentfeatures_version,
NodeDrawType drawtype)
{
int version = readU8(is);
if (version < 6)
throw SerializationError("unsupported TileDef version");
name = deSerializeString(is);
animation.deSerialize(is, version);
u16 flags = readU16(is);
backface_culling = flags & TILE_FLAG_BACKFACE_CULLING;
tileable_horizontal = flags & TILE_FLAG_TILEABLE_HORIZONTAL;
tileable_vertical = flags & TILE_FLAG_TILEABLE_VERTICAL;
has_color = flags & TILE_FLAG_HAS_COLOR;
bool has_scale = flags & TILE_FLAG_HAS_SCALE;
bool has_align_style = flags & TILE_FLAG_HAS_ALIGN_STYLE;
if (has_color) {
color.setRed(readU8(is));
color.setGreen(readU8(is));
color.setBlue(readU8(is));
}
scale = has_scale ? readU8(is) : 0;
if (has_align_style)
align_style = static_cast<AlignStyle>(readU8(is));
else
align_style = ALIGN_STYLE_NODE;
}
开发者ID:EXio4,项目名称:minetest,代码行数:26,代码来源:nodedef.cpp
示例15: deSerializeSimpleSoundSpec
static void deSerializeSimpleSoundSpec(SimpleSoundSpec &ss,
std::istream &is, u8 version)
{
ss.name = deSerializeString(is);
ss.gain = readF1000(is);
ss.pitch = readF1000(is);
}
开发者ID:EXio4,项目名称:minetest,代码行数:7,代码来源:nodedef.cpp
示例16: readU8
CraftDefinition* CraftDefinition::deSerialize(std::istream &is)
{
int version = readU8(is);
if(version != 1) throw SerializationError(
"unsupported CraftDefinition version");
std::string name = deSerializeString(is);
CraftDefinition *def = NULL;
if(name == "shaped")
{
def = new CraftDefinitionShaped;
}
else if(name == "shapeless")
{
def = new CraftDefinitionShapeless;
}
else if(name == "toolrepair")
{
def = new CraftDefinitionToolRepair;
}
else if(name == "cooking")
{
def = new CraftDefinitionCooking;
}
else if(name == "fuel")
{
def = new CraftDefinitionFuel;
}
else
{
infostream<<"Unknown CraftDefinition name=\""<<name<<"\""<<std::endl;
throw SerializationError("Unknown CraftDefinition name");
}
def->deSerializeBody(is, version);
return def;
}
开发者ID:AMDmi3,项目名称:minetest,代码行数:35,代码来源:craftdef.cpp
示例17: LockingChestNodeMetadata
NodeMetadata* LockingChestNodeMetadata::create(std::istream &is, IGameDef *gamedef)
{
LockingChestNodeMetadata *d = new LockingChestNodeMetadata(gamedef);
d->setOwner(deSerializeString(is));
d->m_inventory = new Inventory(gamedef->idef());
d->m_inventory->deSerialize(is);
return d;
}
开发者ID:Anchakor,项目名称:minetest,代码行数:8,代码来源:content_nodemeta.cpp
示例18: readU8
void StaticObject::deSerialize(std::istream &is, u8 version)
{
// type
type = readU8(is);
// pos
pos = readV3F1000(is);
// data
data = deSerializeString(is);
}
开发者ID:Ferk,项目名称:minetest,代码行数:9,代码来源:staticobject.cpp
示例19: readU8
void TileDef::deSerialize(std::istream &is)
{
int version = readU8(is);
name = deSerializeString(is);
animation.type = (TileAnimationType)readU8(is);
animation.aspect_w = readU16(is);
animation.aspect_h = readU16(is);
animation.length = readF1000(is);
if(version >= 1)
backface_culling = readU8(is);
}
开发者ID:BobMikfillin,项目名称:minetest,代码行数:11,代码来源:nodedef.cpp
示例20: readU8
void TileDef::deSerialize(std::istream &is)
{
int version = readU8(is);
if(version != 0)
throw SerializationError("unsupported TileDef version");
name = deSerializeString(is);
animation.type = (TileAnimationType)readU8(is);
animation.aspect_w = readU16(is);
animation.aspect_h = readU16(is);
animation.length = readF1000(is);
}
开发者ID:ajbetteridge,项目名称:minetest,代码行数:11,代码来源:nodedef.cpp
注:本文中的deSerializeString函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论