本文整理汇总了C++中FileXML::read_from_string方法的典型用法代码示例。如果您正苦于以下问题:C++ FileXML::read_from_string方法的具体用法?C++ FileXML::read_from_string怎么用?C++ FileXML::read_from_string使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileXML
的用法示例。
在下文中一共展示了FileXML::read_from_string方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: read_info
int IndexFile::read_info(Asset *test_asset)
{
if(!test_asset) test_asset = asset;
if(test_asset->index_status == INDEX_NOTTESTED)
{
// read start of index data
fread((char*)&(test_asset->index_start), sizeof(int64_t), 1, file);
// read test_asset info from index
char *data;
data = new char[test_asset->index_start];
fread(data, test_asset->index_start - sizeof(int64_t), 1, file);
data[test_asset->index_start - sizeof(int64_t)] = 0;
FileXML xml;
xml.read_from_string(data);
test_asset->read(&xml);
delete [] data;
if(test_asset->format == FILE_UNKNOWN)
{
return 1;
}
}
return 0;
}
示例2: redo
int MainUndo::redo()
{
UndoStackItem *current = undo_stack->current;
//printf("MainUndo::redo 1\n");
//undo_stack->dump();
// Get 1st entry
if(!current) current = undo_stack->first;
// Advance to a before entry
if(current && (undo_stack->number_of(current) % 2))
{
current = NEXT;
}
// Advance to an after entry
if(current && !(undo_stack->number_of(current) % 2))
{
current = NEXT;
}
if(current)
{
FileXML file;
char *current_data = current->get_data();
undo_stack->current = current;
if(current_data)
{
mwindow->set_filename(current->get_filename());
file.read_from_string(current_data);
load_from_undo(&file, current->get_flags());
delete [] current_data;
if(mwindow->gui)
{
// Update menu
mwindow->gui->mainmenu->undo->update_caption(current->get_description());
// Get next after entry
current = NEXT;
if(current)
current = NEXT;
if(current)
mwindow->gui->mainmenu->redo->update_caption(current->get_description());
else
mwindow->gui->mainmenu->redo->update_caption("");
}
}
}
reset_creators();
//undo_stack->dump();
return 0;
}
示例3: handle_command
//.........这里部分代码省略.........
send_result(result,
result_data,
result_size);
delete [] result_data;
}
else
{
int result_size = sizeof(int) * 2;
unsigned char *result_data = new unsigned char[result_size];
*(int*)result_data = frame->get_compressed_size();
*(int*)(result_data + sizeof(int)) = frame->get_keyframe();
send_result(result, result_data, result_size);
delete [] result_data;
}
// printf("FileFork::handle_command %d size=%d\n",
// __LINE__,
// frame->get_compressed_size());
delete frame;
// printf("FileFork::handle_command %d size=%d\n",
// __LINE__,
// frame->get_compressed_size());
break;
}
case CAN_COPY_FROM:
{
FileXML xml;
int64_t position = *(int64_t*)(command_data);
int output_w = *(int*)(command_data + sizeof(int64_t));
int output_h = *(int*)(command_data + sizeof(int64_t) + sizeof(int));
xml.read_from_string((char*)command_data +
sizeof(int64_t) +
sizeof(int) * 2);
xml.read_tag();
// Asset doesn't read the XML path.
Asset *new_asset = new Asset(xml.tag.get_property("SRC"));
new_asset->read(&xml, 1);
result = file->can_copy_from(new_asset,
position,
output_w,
output_h);
send_result(result, 0, 0);
new_asset->Garbage::remove_user();
break;
}
case COLORMODEL_SUPPORTED:
{
int colormodel = *(int*)command_data;
result = file->colormodel_supported(colormodel);
send_result(result, 0, 0);
break;
}
case FILE_MEMORY_USAGE:
result = file->file_memory_usage();
send_result(result, 0, 0);
break;
case SET_PROGRAM:
{
int no = *(int*)command_data;
result = file->set_program(no);
示例4: undo
int MainUndo::undo()
{
UndoStackItem *current = undo_stack->current;
char after_description[BCTEXTLEN];
after_description[0] = 0;
//printf("MainUndo::undo 1\n");
//undo_stack->dump();
// Rewind to an after entry
if(current && !(undo_stack->number_of(current) % 2))
{
current = PREVIOUS;
}
// Rewind to a before entry
if(current && (undo_stack->number_of(current) % 2))
{
strcpy(after_description, current->get_description());
current = PREVIOUS;
}
// Now have an even number
if(current)
{
undo_stack->current = current;
// Set the redo text to the current description
if(mwindow->gui)
mwindow->gui->mainmenu->redo->update_caption(
after_description);
FileXML file;
char *current_data = current->get_data();
if(current_data)
{
file.read_from_string(current_data);
load_from_undo(&file, current->get_flags());
//printf("MainUndo::undo %d %s\n", __LINE__, current->get_filename());
mwindow->set_filename(current->get_filename());
delete [] current_data;
// move current entry back one step
undo_stack->pull();
if(mwindow->gui)
{
// Now update the menu with the after entry
current = PREVIOUS;
// Must be a previous entry to perform undo
if(current)
mwindow->gui->mainmenu->undo->update_caption(
current->get_description());
else
mwindow->gui->mainmenu->undo->update_caption("");
}
}
}
//undo_stack->dump();
reset_creators();
return 0;
}