本文整理汇总了C++中ObjectEntry类的典型用法代码示例。如果您正苦于以下问题:C++ ObjectEntry类的具体用法?C++ ObjectEntry怎么用?C++ ObjectEntry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ObjectEntry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: saveConfigFile
void PolycodeIDEApp::saveConfigFile() {
Config *config = CoreServices::getInstance()->getConfig();
Object configFile;
configFile.root.name = "config";
configFile.root.addChild("open_projects");
configFile.root.addChild("syntax_theme", globalSyntaxTheme->name);
for(int i=0; i < projectManager->getProjectCount(); i++) {
PolycodeProject *project = projectManager->getProjectByIndex(i);
ObjectEntry *projectEntry = configFile.root["open_projects"]->addChild("project");
projectEntry->addChild("name", project->getProjectName());
projectEntry->addChild("path", project->getProjectFile());
}
configFile.root.addChild("settings");
ObjectEntry *textEditorEntry = configFile.root["settings"]->addChild("text_editor");
textEditorEntry->addChild("use_external", config->getStringValue("Polycode", "useExternalTextEditor"));
textEditorEntry->addChild("command", config->getStringValue("Polycode", "externalTextEditorCommand"));
#if defined(__APPLE__) && defined(__MACH__)
core->createFolder(core->getUserHomeDirectory()+"/Library/Application Support/Polycode");
configFile.saveToXML(core->getUserHomeDirectory()+"/Library/Application Support/Polycode/config.xml");
#else
core->createFolder(core->getUserHomeDirectory()+"/.polycode");
configFile.saveToXML(core->getUserHomeDirectory()+"/.polycode/config.xml");
#endif
}
示例2: parseOpenNodesIntoEntry
void parseOpenNodesIntoEntry(ObjectEntry *entry, UITree *node, bool addNewNode) {
bool hasOpenNodes = false;
for(int i=0; i < node->getNumTreeChildren(); i++) {
UITree *child = node->getTreeChild(i);
if(!child->isCollapsed()) {
hasOpenNodes = true;
}
}
if(!hasOpenNodes) {
return;
}
ObjectEntry *childNodes = entry;
if(addNewNode) {
childNodes = entry->addChild("child_nodes");
}
for(int i=0; i < node->getNumTreeChildren(); i++) {
UITree *child = node->getTreeChild(i);
if(!child->isCollapsed()) {
ObjectEntry *newEntry = childNodes->addChild("open_node");
newEntry->addChild("name", child->getLabelText());
parseOpenNodesIntoEntry(newEntry, child, true);
}
}
}
示例3: ObjectEntry
ObjectEntry *PolycodeTextEditor::getEditorConfig() {
ObjectEntry *configEntry = new ObjectEntry();
configEntry->addChild("scroll_offset", textInput->getScrollContainer()->getVScrollBar()->getScrollValue());
return configEntry;
}
示例4: SetOrRemoveObject
static nsresult
SetOrRemoveObject(PLDHashTable& table, nsIContent* aKey, nsISupports* aValue)
{
if (aValue) {
// lazily create the table, but only when adding elements
if (!table.ops &&
!PL_DHashTableInit(&table, &ObjectTableOps, nullptr,
sizeof(ObjectEntry), 16)) {
table.ops = nullptr;
return NS_ERROR_OUT_OF_MEMORY;
}
aKey->SetFlags(NODE_MAY_BE_IN_BINDING_MNGR);
return AddObjectEntry(table, aKey, aValue);
}
// no value, so remove the key from the table
if (table.ops) {
ObjectEntry* entry =
static_cast<ObjectEntry*>
(PL_DHashTableOperate(&table, aKey, PL_DHASH_LOOKUP));
if (entry && PL_DHASH_ENTRY_IS_BUSY(entry)) {
// Keep key and value alive while removing the entry.
nsCOMPtr<nsISupports> key = entry->GetKey();
nsCOMPtr<nsISupports> value = entry->GetValue();
RemoveObjectEntry(table, aKey);
}
}
return NS_OK;
}
示例5: ObjectEntry
ObjectEntry *PolycodeProjectBrowser::getBrowserConfig() {
ObjectEntry *configEntry = new ObjectEntry();
configEntry->name = "project_browser";
configEntry->addChild("width", getWidth());
ObjectEntry *openNodes = configEntry->addChild("open_nodes");
parseOpenNodesIntoEntry(openNodes, treeContainer->getRootNode(), false);
return configEntry;
}
示例6: StoreObjEntry
void ObjectEntryList :: StoreObjEntry (BinArray *array, BinSArrayObjEntry *obj_entry )
{
ObjectEntry *objentry = (ObjectEntry *)obj_entry;
EB_Number entnr;
if ( objentry )
{
entnr = objentry->get_object_id();
instance_pool->StoreInstance(entnr,(EBI *)objentry,objentry->get_ext_inst(),objentry->get_cluster_number().get_ebsnum());
BinArray::StoreObjEntry(array,obj_entry);
}
}
示例7: saveConfigFile
void PolycodeIDEApp::saveConfigFile() {
Object configFile;
configFile.root.name = "config";
configFile.root.addChild("open_projects");
for(int i=0; i < projectManager->getProjectCount(); i++) {
PolycodeProject *project = projectManager->getProjectByIndex(i);
ObjectEntry *projectEntry = configFile.root["open_projects"]->addChild("project");
projectEntry->addChild("name", project->getProjectName());
projectEntry->addChild("path", project->getProjectFile());
}
core->createFolder("/Users/ivansafrin/Library/Application Support/Polycode");
configFile.saveToXML("/Users/ivansafrin/Library/Application Support/Polycode/config.xml");
}
示例8: LookupObject
// helper routine for looking up an existing entry. Note that the
// return result is NOT addreffed
static nsISupports*
LookupObject(PLDHashTable& table, nsIContent* aKey)
{
if (aKey && aKey->HasFlag(NODE_MAY_BE_IN_BINDING_MNGR)) {
ObjectEntry *entry =
static_cast<ObjectEntry*>
(PL_DHashTableOperate(&table, aKey, PL_DHASH_LOOKUP));
if (PL_DHASH_ENTRY_IS_BUSY(entry))
return entry->GetValue();
}
return nullptr;
}
示例9: saveConfigFile
void PolycodeIDEApp::saveConfigFile() {
Config *config = CoreServices::getInstance()->getConfig();
Object configFile;
configFile.root.name = "config";
configFile.root.addChild("open_projects");
configFile.root.addChild("syntax_theme", globalSyntaxTheme->name);
configFile.root.addChild("ui_theme", config->getStringValue("Polycode", "uiTheme"));
configFile.root.addChild("texture_filtering_mode", config->getStringValue("Polycode", "textureFilteringMode"));
configFile.root.addChild("app_width", String::IntToString(core->getXRes()));
configFile.root.addChild("app_height", String::IntToString(core->getYRes()));
ObjectEntry *consoleEntry = configFile.root.addChild("console");
consoleEntry->addChild("size", frame->getConsoleSize());
consoleEntry->addChild("showing", frame->isShowingConsole());
for(int i=0; i < projectManager->getProjectCount(); i++) {
PolycodeProject *project = projectManager->getProjectByIndex(i);
ObjectEntry *projectEntry = configFile.root["open_projects"]->addChild("project");
projectEntry->addChild("is_active", (project == projectManager->getActiveProject()));
projectEntry->addChild("name", project->getProjectName());
projectEntry->addChild("path", project->getProjectFile());
ObjectEntry *projectFrameConfig = frame->getFrameConfigForProject(project);
if(projectFrameConfig) {
projectEntry->addChild(projectFrameConfig);
}
}
configFile.root.addChild("settings");
ObjectEntry *textEditorEntry = configFile.root["settings"]->addChild("text_editor");
textEditorEntry->addChild("use_external", config->getStringValue("Polycode", "useExternalTextEditor"));
textEditorEntry->addChild("command", config->getStringValue("Polycode", "externalTextEditorCommand"));
#if defined(__APPLE__) && defined(__MACH__)
core->createFolder(core->getUserHomeDirectory()+"/Library/Application Support/Polycode");
configFile.saveToXML(core->getUserHomeDirectory()+"/Library/Application Support/Polycode/config.xml");
#else
core->createFolder(core->getUserHomeDirectory()+"/.polycode");
configFile.saveToXML(core->getUserHomeDirectory()+"/.polycode/config.xml");
#endif
}
示例10: saveConfigFile
void PolycodeIDEApp::saveConfigFile() {
Object configFile;
configFile.root.name = "config";
configFile.root.addChild("open_projects");
configFile.root.addChild("syntax_theme", globalSyntaxTheme->name);
for(int i=0; i < projectManager->getProjectCount(); i++) {
PolycodeProject *project = projectManager->getProjectByIndex(i);
ObjectEntry *projectEntry = configFile.root["open_projects"]->addChild("project");
projectEntry->addChild("name", project->getProjectName());
projectEntry->addChild("path", project->getProjectFile());
}
#if defined(__APPLE__) && defined(__MACH__)
core->createFolder(core->getUserHomeDirectory()+"/Library/Application Support/Polycode");
configFile.saveToXML(core->getUserHomeDirectory()+"/Library/Application Support/Polycode/config.xml");
#else
core->createFolder(core->getUserHomeDirectory()+"/.polycode");
configFile.saveToXML(core->getUserHomeDirectory()+"/.polycode/config.xml");
#endif
}
示例11: saveFile
void PolycodeSpriteEditor::saveFile() {
Object saveObject;
saveObject.root.name = "sprite";
ObjectEntry *image = saveObject.root.addChild("image");
image->addChild("frameWidth", widthProp->get());
image->addChild("frameHeight", heightProp->get());
image->addChild("fileName", previewSprite->getTexture()->getResourcePath());
ObjectEntry *animations = saveObject.root.addChild("animations");
for(int i=0; i < animationEntries.size(); i++) {
ObjectEntry *animation = animations->addChild("animation");
animation->addChild("name", animationEntries[i]->nameInput->getText());
animation->addChild("frames", animationEntries[i]->framesInput->getText());
animation->addChild("speed", atof(animationEntries[i]->speedInput->getText().c_str()));
}
saveObject.saveToXML(filePath);
}
示例12: AddObjectEntry
// helper routine for adding a new entry
static nsresult
AddObjectEntry(PLDHashTable& table, nsISupports* aKey, nsISupports* aValue)
{
NS_ASSERTION(aKey, "key must be non-null");
if (!aKey) return NS_ERROR_INVALID_ARG;
ObjectEntry *entry =
static_cast<ObjectEntry*>
(PL_DHashTableOperate(&table, aKey, PL_DHASH_ADD));
if (!entry)
return NS_ERROR_OUT_OF_MEMORY;
// only add the key if the entry is new
if (!entry->GetKey())
entry->SetKey(aKey);
// now attach the new entry - note that entry->mValue could possibly
// have a value already, this will release that.
entry->SetValue(aValue);
return NS_OK;
}
示例13: exportToFile
int exportToFile(String prefix, bool swapZY, bool addSubmeshes, bool listOnly, bool exportEntity) {
Object sceneObject;
sceneObject.root.name = "entity";
ObjectEntry *parentEntry = sceneObject.root.addChild("root");
parentEntry->addChild("id", "");
parentEntry->addChild("tags", "");
parentEntry->addChild("type", "Entity");
parentEntry->addChild("cR", "1");
parentEntry->addChild("cG", "1");
parentEntry->addChild("cB", "1");
parentEntry->addChild("cA", "1");
parentEntry->addChild("blendMode", "0");
parentEntry->addChild("sX", 1.0);
parentEntry->addChild("sY", 1.0);
parentEntry->addChild("sZ", 1.0);
parentEntry->addChild("rX", 0.0);
parentEntry->addChild("rY", 0.0);
parentEntry->addChild("rZ", 0.0);
parentEntry->addChild("rW", 1.0);
parentEntry->addChild("pX", 0.0);
parentEntry->addChild("pY", 0.0);
parentEntry->addChild("pZ", 0.0);
parentEntry->addChild("bbX", 0.0);
parentEntry->addChild("bbY", 0.0);
parentEntry->addChild("bbZ", 0.0);
ObjectEntry *children = parentEntry->addChild("children");
Polycode::Mesh *mesh = new Polycode::Mesh(Mesh::TRI_MESH);
mesh->indexedMesh = true;
addToMesh(prefix, mesh, scene, scene->mRootNode, swapZY, addSubmeshes, listOnly, children);
if(addSubmeshes) {
String fileNameMesh;
if(prefix != "") {
fileNameMesh = prefix+".mesh";
} else {
fileNameMesh = "out.mesh";
}
if(listOnly) {
printf("%s\n", fileNameMesh.c_str());
} else {
OSFILE *outFile = OSBasics::open(fileNameMesh.c_str(), "wb");
mesh->saveToFile(outFile, writeNormals, writeTangents, writeColors, writeBoneWeights, writeUVs, writeSecondaryUVs);
OSBasics::close(outFile);
}
}
if(hasWeights) {
if(listOnly) {
printf("%s.skeleton\n", prefix.c_str());
} else {
printf("Mesh has weights, exporting skeleton...\n");
}
String fileNameSkel;
if(prefix != "") {
fileNameSkel = prefix+".skeleton";
} else {
fileNameSkel = "out.skeleton";
}
ISkeleton *skeleton = new ISkeleton();
for (int n = 0; n < scene->mRootNode->mNumChildren; ++n) {
if(scene->mRootNode->mChildren[n]->mNumChildren > 0) {
addToISkeleton(skeleton, NULL, scene, scene->mRootNode->mChildren[n]);
}
}
if(scene->HasAnimations()) {
printf("Importing animations...\n");
for(int i=0; i < scene->mNumAnimations;i++) {
aiAnimation *a = scene->mAnimations[i];
if(listOnly) {
printf("%s%s.anim\n", prefix.c_str(), a->mName.data);
} else {
printf("Importing '%s' (%d tracks)\n", a->mName.data, a->mNumChannels);
}
IAnimation *anim = new IAnimation();
anim->tps = a->mTicksPerSecond;
anim->name = a->mName.data;
anim->numTracks = a->mNumChannels;
anim->length = a->mDuration/a->mTicksPerSecond;
for(int c=0; c < a->mNumChannels; c++) {
aiNodeAnim *nodeAnim = a->mChannels[c];
ITrack *track = new ITrack();
track->nodeAnim = nodeAnim;
//.........这里部分代码省略.........
示例14: main
//.........这里部分代码省略.........
return 1;
}
if(configFile.root["defaultHeight"]) {
printf("Height: %d\n", configFile.root["defaultHeight"]->intVal);
defaultHeight = configFile.root["defaultHeight"]->intVal;
} else {
printf("Required parameter: \"defaultHeight\" is missing from config file!\n");
return 1;
}
// start optional params
if(configFile.root["frameRate"]) {
printf("Frame rate: %d\n", configFile.root["frameRate"]->intVal);
frameRate = configFile.root["frameRate"]->intVal;
}
if(configFile.root["antiAliasingLevel"]) {
printf("Anti-aliasing level: %d\n", configFile.root["antiAliasingLevel"]->intVal);
antiAliasingLevel = configFile.root["antiAliasingLevel"]->intVal;
}
if(configFile.root["fullScreen"]) {
fullScreen = configFile.root["fullScreen"]->boolVal;
if(fullScreen) {
printf("Full-screen: true\n");
} else {
printf("Full-screen: false\n");
}
}
if(configFile.root["backgroundColor"]) {
ObjectEntry *color = configFile.root["backgroundColor"];
if((*color)["red"] && (*color)["green"] && (*color)["blue"]) {
backgroundColorR = (*color)["red"]->NumberVal;
backgroundColorG = (*color)["green"]->NumberVal;
backgroundColorB = (*color)["blue"]->NumberVal;
printf("Background color: %f %f %f\n", backgroundColorR, backgroundColorG, backgroundColorB);
} else {
printf("backgroundColor node specified, but missing all three color attributes (red,green,blue). Ignoring.\n");
}
}
zipFile z = zipOpen(getArg("--out").c_str(), 0);
Object runInfo;
runInfo.root.name = "PolycodeApp";
runInfo.root.addChild("entryPoint", entryPoint);
runInfo.root.addChild("defaultHeight", defaultHeight);
runInfo.root.addChild("defaultWidth", defaultWidth);
runInfo.root.addChild("frameRate", frameRate);
runInfo.root.addChild("antiAliasingLevel", antiAliasingLevel);
runInfo.root.addChild("fullScreen", fullScreen);
ObjectEntry *color = runInfo.root.addChild("backgroundColor");
color->addChild("red", backgroundColorR);
color->addChild("green", backgroundColorG);
color->addChild("blue", backgroundColorB);
addFileToZip(z, entryPoint, entryPoint, false);
if(configFile.root["modules"]) {
#ifdef _WINDOWS
示例15: saveFile
bool PolycodeProject::saveFile() {
configFile.root["frameRate"]->intVal = data.frameRate;
configFile.root["defaultWidth"]->intVal = data.defaultWidth;
configFile.root["defaultHeight"]->intVal = data.defaultHeight;
configFile.root["entryPoint"]->stringVal = data.entryPoint;
configFile.root["entryPoint"]->type = ObjectEntry::STRING_ENTRY;
configFile.root["textureFiltering"]->type = ObjectEntry::STRING_ENTRY;
configFile.root["textureFiltering"]->stringVal = data.filteringMode;
ObjectEntry *color = configFile.root["backgroundColor"];
(*color)["red"]->NumberVal = data.backgroundColorR;
(*color)["red"]->type = ObjectEntry::FLOAT_ENTRY;
(*color)["green"]->NumberVal = data.backgroundColorG;
(*color)["green"]->type = ObjectEntry::FLOAT_ENTRY;
(*color)["blue"]->NumberVal = data.backgroundColorB;
(*color)["blue"]->type = ObjectEntry::FLOAT_ENTRY;
if(configFile.root["modules"]) {
configFile.root["modules"]->Clear();
}
/*
for(int j=0; j < data.modules.size(); j++) {
if(!configFile.root["modules"]) {
configFile.root.addChild("modules");
}
configFile.root["modules"]->type = ObjectEntry::ARRAY_ENTRY;
configFile.root["modules"]->addChild("module", data.modules[j]);
CoreServices::getInstance()->getResourceManager()->addArchive("Standalone/Modules/"+data.modules[j]+"/API");
}
*/
if(configFile.root["fonts"]) {
configFile.root["fonts"]->Clear();
}
for(int j=0; j < data.fonts.size(); j++) {
if(!configFile.root["fonts"]) {
configFile.root.addChild("fonts");
}
configFile.root["fonts"]->type = ObjectEntry::ARRAY_ENTRY;
ObjectEntry *objectEntry = configFile.root["fonts"]->addChild("font");
objectEntry->addChild("name", data.fonts[j].fontName);
objectEntry->addChild("path", data.fonts[j].fontPath);
}
if(configFile.root["packedItems"]) {
configFile.root["packedItems"]->Clear();
}
vector<OSFileEntry> files = OSBasics::parseFolder(projectFolder, false);
for(int i=0; i < files.size(); i++) {
OSFileEntry entry = files[i];
if(!configFile.root["packedItems"]) {
configFile.root.addChild("packedItems");
}
if(entry.type == OSFileEntry::TYPE_FOLDER) {
ObjectEntry *objectEntry = configFile.root["packedItems"]->addChild("item");
objectEntry->addChild("type", "folder");
objectEntry->addChild("path", entry.name);
} else {
if(entry.fullPath != projectFile) {
ObjectEntry *objectEntry = configFile.root["packedItems"]->addChild("item");
objectEntry->addChild("type", "file");
objectEntry->addChild("path", entry.name);
}
}
}
unsigned int afMap[6] = {0,1,2,4,8,16};
unsigned int aaMap[4] = {0,2,4,6};
configFile.root["antiAliasingLevel"]->intVal = data.aaLevel;
configFile.root["anisotropyLevel"]->intVal = data.anisotropy;
configFile.root["vSync"]->boolVal = data.vSync;
configFile.saveToXML(projectFile);
return true;
}