TInt Cdmatest::DeleteObjectL( CStifItemParser& aItem ) { TInt ret( KErrNone ); // Print to UI TestModuleIf().Printf( 0, _L("Camtest"), _L("DeleteObjectL") ); TPtrC8 nodename( GetNextStringLC ( aItem, _L("Nodename") )->Des() ) ; SetURIL(nodename) ; HBufC8 *luid = GetLuidAllocLC( *iURI ); Adapter()->DeleteObjectL( *iURI, *luid, 11 ) ; if ( iStatus == MSmlDmAdapter::EOk ) { iLog->Log( _L("DeleteNode: DeleteObjectL Successful! %d" ), iStatus ); } else { iLog->Log( _L("DeleteNode: DeleteObjectL FetchLeafObjectL Error ! %d" ), iStatus ); ret = KErrGeneral ; } CleanupStack::PopAndDestroy( luid ); // luid CleanupStack::PopAndDestroy(); // nodename iLog->Log( _L("ExecuteLeafDataL Test Complete with status %d" ), ret ); return ret; }
TInt Cdmatest::AddNodeL( CStifItemParser& aItem ) { TInt ret( KErrNone ); // Print to UI TestModuleIf().Printf( 0, _L("Cdmatest"), _L("AddNodeL") ); TPtrC8 nodename( GetNextStringLC ( aItem, _L("nodename" ) )->Des() ) ; SetURIL( nodename ); Adapter()->AddNodeObjectL( *iURI, KEmptyType, 8 ) ; if ( iStatus == MSmlDmAdapter::EOk ) { iLog->Log( _L("AddNodeL: AddNodeObjectL Successful! %d" ), iStatus ); } else { iLog->Log( _L("AddNodeL: AddNodeObjectL Error ! %d" ), iStatus ); ret = KErrGeneral ; } CleanupStack::PopAndDestroy() ; // nodename iLog->Log( _L("AddNodeL Test Complete with status %d" ), ret ); return ret; }
TInt Cdmatest::FetchNodeL( CStifItemParser& aItem ) { TInt ret( KErrNone ); // Print to UI TestModuleIf().Printf( 0, _L("Cdmatest"), _L("FetchNodeL") ); iResultsFunction = FetchNodeResultsL; TPtrC8 nodename( GetNextStringLC( aItem, _L(" nodename" ) )->Des() ) ; SetURIL(nodename) ;// HBufC8 *luid = GetLuidAllocLC( *iURI ); Adapter()->ChildURIListL( *iURI, *luid, *iEmptyMappingInfoArray, 4, 5) ; if ( iStatus == MSmlDmAdapter::EOk ) { } else { iLog->Log( _L("FetchNodeL: ChildUriList Error ! %d" ), iStatus ); ret = KErrGeneral ; } CleanupStack::PopAndDestroy( luid ) ; CleanupStack::PopAndDestroy() ; // nodename iLog->Log( _L("FetchNodeL: Test Complete with status %d" ), ret ); return ret; }
nuiNativeResourceVolume::nuiNativeResourceVolume() : nglVolume(_T("rsrc"), nglPath(), _T("Native resources"), nglPathVolume::ReadOnly, nglPathVolume::eTypeUnknown) { App->GetLog().SetLevel(_T("StopWatch"), 100); nuiStopWatch watch(_T("nuiNativeResourceVolume creation")); std::vector<nglPath> resources; nuiNativeResource::GetResourcesList(resources); watch.AddIntermediate(_T("GetResourcesList")); //NGL_OUT(_T("Found %d resources in this executable\n"), resources.size()); for (size_t i = 0; i < resources.size(); i++) { nglPath tmp(resources[i]); nglPath ref; while (tmp != ref && tmp != nglPath(_T("/"))) { ref = tmp; tmp = tmp.GetParent(); nglString nodename(ref.GetNodeName()); if (!nodename.IsEmpty()) { mItems[tmp].insert(nodename); //NGL_OUT(_T("mItems[%ls] <- '%ls'\n"), tmp.GetChars(), nodename.GetChars()); } } } }
TInt Cdmatest::UpdateLeafDataURLL( CStifItemParser& aItem ) { TInt ret( KErrNone ); // Print to UI TestModuleIf().Printf( 0, _L("Cdmatest"), _L("UpdateLeafDataL") ); TPtrC8 nodename( GetNextStringLC ( aItem, _L("Node name") )->Des() ) ; TPtrC8 http (GetNextStringLC( aItem, _L("http"))->Des() ); TPtrC8 url (GetNextStringLC( aItem, _L("rest of url"))->Des() ); HBufC8 *mime = GetNextStringLC( aItem, _L("mime") ) ; SetURIL( nodename ); _LIT8( KTag, "://" ); HBufC8 *fullurl = HBufC8::NewLC( http.Length() + KTag().Length() + url.Length() ); TPtr8 pfullurl( fullurl->Des() ); pfullurl.Copy( http ) ; pfullurl.Append( KTag ); pfullurl.Append( url ); TPtrC8 mimePtr( *mime == KNullDesC8 ? KDefaultType() : mime->Des() ); HBufC8 *luid = GetLuidAllocLC( *iURI ); /** virtual void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, const TDesC8& aObject, const TDesC8& aType, TInt aStatusRef ) = 0; */ Adapter()->UpdateLeafObjectL( *iURI , *luid, pfullurl, mimePtr, 3); if ( iStatus == MSmlDmAdapter::EOk ) { iLog->Log( _L("UpdateLeafDataL: UpdateLeafObjectL Successful! %d" ), iStatus ); } else { iLog->Log( _L("UpdateLeafDataL UpdateLeafObjectL Error ! %d" ), iStatus ); ret = KErrGeneral ; } CleanupStack::PopAndDestroy( luid ); // CleanupStack::PopAndDestroy( mime ); // mime CleanupStack::PopAndDestroy(); // url CleanupStack::PopAndDestroy(); // http CleanupStack::PopAndDestroy(); // nodename iLog->Log( _L("UpdateLeafDataL Test Complete with status %d" ), ret ); return ret; }
TInt Cdmatest::UpdateLeafL( CStifItemParser& aItem ) { TInt ret( KErrNone ); // Print to UI TestModuleIf().Printf( 0, _L("Cdmatest"), _L("UpdateLeafL") ); TPtrC8 nodename( GetNextStringLC ( aItem, _L("Node name") )->Des() ) ; TPtrC8 data (GetNextStringLC( aItem, _L("datafile"))->Des() ); HBufC8 *mime = GetNextStringLC( aItem, _L("mime") ) ; SetURIL( nodename ); TPtrC8 parentURI(RemoveLastSeg(nodename)); HBufC8 *luid = GetLuidAllocLC( parentURI ); TDataType type; TPtrC8 mimePtr( *mime == KNullDesC8 ? type.Des8() : mime->Des() ); /** virtual void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, const TDesC8& aObject, const TDesC8& aType, TInt aStatusRef ) = 0; */ Adapter()->UpdateLeafObjectL( *iURI , *luid, data, mimePtr, 3); if ( iStatus == MSmlDmAdapter::EOk ) { iLog->Log( _L("UpdateLeafL: UpdateLeafObjectL Successful! %d" ), iStatus ); } else { iLog->Log( _L("UpdateLeafL UpdateLeafObjectL Error ! %d" ), iStatus ); ret = KErrGeneral ; } CleanupStack::PopAndDestroy(); // loadfile CleanupStack::PopAndDestroy(); // luid CleanupStack::PopAndDestroy(); // mime CleanupStack::PopAndDestroy(); // nodename iLog->Log( _L("UpdateLeafL Test Complete with status %d" ), ret ); return ret; }
HBufC8 *Cdmatest::GetNextStringLC ( CStifItemParser& aItem, const TDesC &aName ) { TPtrC nodename( KNullDesC ); TInt i( aItem.GetNextString ( nodename ) ); if ( i != KErrNone ) { iLog->Log( _L( "ERROR Reading '%S' argument: 0x%X" ), &aName, i ); } else { iLog->Log( _L("%S: %S"), &aName, &nodename); } HBufC8 *buf = HBufC8::NewLC( nodename.Length() ) ; buf->Des().Copy( nodename ); return buf; }
static void visit_one_node(xmlNode *node) { char *content; char buffer[MAXNAME]; const char *name; content = node->content; if (!content || xmlIsBlankNode(node)) return; /* Don't print out the node name if it is "text" */ while (!node->name || !strcmp(node->name, "text")) node = node->parent; name = nodename(node, buffer, sizeof(buffer)); entry(name, content); }
TInt Cdmatest::ExecuteLeafL( CStifItemParser& aItem ) { TInt ret( KErrNone ); // Print to UI TestModuleIf().Printf( 0, _L("Camtest"), _L("ExecuteLeafL") ); iResultsFunction = NULL; TPtrC8 nodename( GetNextStringLC ( aItem, _L("Nodename") )->Des() ) ; TPtrC8 data( GetNextStringLC ( aItem, _L("Input file") )->Des() ) ; SetURIL(nodename) ; /* virtual void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, const TDesC8& aArgument, const TDesC8& aType, TInt aStatusRef ) = 0; */ TDataType type; TPtrC8 parentURI(RemoveLastSeg(nodename)); HBufC8 *luid = GetLuidAllocLC( parentURI ); Adapter()->ExecuteCommandL( *iURI, *luid, data, KEmptyType, 11 ) ; if ( iStatus == MSmlDmAdapter::EOk ) { iLog->Log( _L("ExecuteLeafL: ExecuteCommandL Successful! %d" ), iStatus ); } else { iLog->Log( _L("ExecuteLeafL: ExecuteCommandL FetchLeafObjectL Error ! %d" ), iStatus ); ret = KErrGeneral ; } CleanupStack::PopAndDestroy( luid ); // luid CleanupStack::PopAndDestroy(); // data CleanupStack::PopAndDestroy(); // nodename iLog->Log( _L("ExecuteLeafL: Test Complete with status %d" ), ret ); return ret; }
void Editor_Export::processNode (xmlNodePtr node) { switch (node->type) { case XML_ELEMENT_NODE: { openElementNode (node); processNodeChildren (node); closeElementNode (node); break; } case XML_ATTRIBUTE_NODE: { processAttributeNode (node); break; } case XML_TEXT_NODE: { processTextNode (node); break; } case XML_CDATA_SECTION_NODE: case XML_ENTITY_REF_NODE: case XML_ENTITY_NODE: case XML_PI_NODE: case XML_COMMENT_NODE: case XML_DOCUMENT_NODE: case XML_DOCUMENT_TYPE_NODE: case XML_DOCUMENT_FRAG_NODE: case XML_NOTATION_NODE: { break; } default: { string nodename ((char *) node->name); Database_Logs::log ("Unknown DOM node " + nodename + " while saving editor text"); break; } } }
bool Imageset::Load(xml::node* imgset, const std::string& name, System& sys) { if(imgset) { xml::node texsnode = imgset->child("Textures"); if(!texsnode) { sys.logEvent(log::warning, std::string("The imageset ") + name + " doesn't have any texture information. Imageset is unaffected"); return false; } xml::node imgsnode = imgset->child("Images"); if(!imgsnode) { sys.logEvent(log::warning, std::string("The imageset ") + name + " doesn't have any image information. Imageset is unaffected"); return false; } typedef boost::unordered_map<std::string, size_t> TextureOrdinals; TextureOrdinals textureOrdinals; xml::node texnode = texsnode.first_child(); while(!texnode.empty()) { std::string nodename(texnode.name()); if(nodename == "Texture") { std::string texname = texnode["Name"].value(); std::string filename = texnode["Filename"].value(); if(!texname.size()) texname = filename; TextureOrdinals::iterator it = textureOrdinals.find(texname); if(it == textureOrdinals.end()) { TexturePtr tex = sys.getRenderer().createTexture("imageset\\" + filename); if(tex) { m_textures.push_back(tex); textureOrdinals.insert(std::make_pair(texname, m_textures.size() - 1)); } else { sys.logEvent(log::warning, std::string("The imageset ") + name + " unable to load texture '" + texname + "', file '" + filename + "'."); } } } texnode = texnode.next_sibling(); } xml::node imgnode = imgsnode.first_child(); while(!imgnode.empty()) { std::string nodename(imgnode.name()); if(nodename == "Image") { std::string imgname = imgnode["Name"].value(); float width = imgnode["Width"].as_float(); float height = imgnode["Height"].as_float(); Image::SubImages subImages; xml::node rectnode = imgnode.first_child(); while(!rectnode.empty()) { if(std::string(rectnode.name()) == "Rect") { std::string texname = rectnode["Texture"].value(); TextureOrdinals::iterator it = textureOrdinals.find(texname); if(it != textureOrdinals.end()) { SubImage sub; sub.m_ordinal = it->second; float left = rectnode["SrcLeft"].as_float(); float top = rectnode["SrcTop"].as_float(); float right = rectnode["SrcRight"].as_float(); float bottom = rectnode["SrcBottom"].as_float(); sub.m_src = Rect(left, top, right, bottom); float y = rectnode["YPos"].as_float(); float x = rectnode["XPos"].as_float(); sub.m_offset = point(x, y); if(!rectnode["CropLeft"].empty()) { float cropx = rectnode["CropLeft"].as_float(); float cropy = rectnode["CropTop"].as_float(); float w = rectnode["OrigWidth"].as_float(); float h = rectnode["OrigHeight"].as_float(); sub.m_crop = Rect(point(cropx, cropy), Size(w, h)); } subImages.push_back(sub); } else { sys.logEvent(log::warning, std::string("The imageset ") + name + " can't find texture '" + texname + "' for the image '" + imgname + "'."); } } rectnode = rectnode.next_sibling(); } if(subImages.size()) { // TODO: optimize multiple copy m_images.insert(std::make_pair(imgname, Image(this, imgname, Size(width, height), subImages))); } else { sys.logEvent(log::warning, std::string("The imageset ") + name + " can't find any rectangles for the image '" + imgname + "'. Skipping this image..."); } } imgnode = imgnode.next_sibling(); } return true; } return false; }
bool Imageset::Load(xml::node* imgset, const std::string& name, System& sys) { if(imgset) { xml::node texsnode = imgset->child("Textures"); if(!texsnode) { sys.logEvent(log::warning, std::string("The imageset ") + name + " doesn't have any texture information. imageset is unaffected"); return false; } xml::node imgsnode = imgset->child("Images"); if(!imgsnode) { sys.logEvent(log::warning, std::string("The imageset ") + name + " doesn't have any image information. imageset is unaffected"); return false; } typedef std::unordered_map<std::string, size_t> TextureOrdinals; TextureOrdinals textureOrdinals; xml::node texnode = texsnode.first_child(); while(!texnode.empty()) { std::string nodename(texnode.name()); if(nodename == "Texture") { std::string texname = texnode["id"].value(); std::string filename = texnode["file"].value(); if(!texname.size()) texname = filename; TextureOrdinals::iterator it = textureOrdinals.find(texname); if(it == textureOrdinals.end()) { TexturePtr tex = sys.getRenderer().createTexture("imageset/" + filename); if(tex) { m_textures.push_back(tex); textureOrdinals.insert(std::make_pair(texname, m_textures.size() - 1)); } else { sys.logEvent(log::warning, std::string("The imageset ") + name + " unable to load texture '" + texname + "', file '" + filename + "'."); } } } texnode = texnode.next_sibling(); } xml::node imgnode = imgsnode.first_child(); while(!imgnode.empty()) { std::string nodename(imgnode.name()); if(nodename == "Image") { std::string imgname = imgnode["id"].value(); float width = imgnode["width"].as_float(); float height = imgnode["height"].as_float(); bool isAdditiveBlend = imgnode["additive"].as_bool(); Image::SubImages subImages; xml::node rectnode = imgnode.first_child(); while(!rectnode.empty()) { if (std::string(rectnode.name()) != "Rect") continue; std::string texname = rectnode["texture"].value(); TextureOrdinals::iterator it = texname.empty() ? textureOrdinals.begin() : textureOrdinals.find(texname); if (it == textureOrdinals.end()) { sys.logEvent(log::warning, std::string("The imageset ") + name + " can't find texture '" + texname + "' for the image '" + imgname + "'."); continue; } SubImage sub; sub.m_ordinal = it->second; sub.m_src.m_left = rectnode["left"].as_int(); sub.m_src.m_top = rectnode["top"].as_int(); sub.m_src.m_right = rectnode["right"].as_int(); sub.m_src.m_bottom = rectnode["bottom"].as_int(); sub.m_offset.x = rectnode["x"].as_int(); sub.m_offset.y = rectnode["y"].as_int(); if (!rectnode["CropLeft"].empty()) { float cropx = rectnode["CropLeft"].as_int(); float cropy = rectnode["CropTop"].as_int(); float w = rectnode["OrigWidth"].as_int(); float h = rectnode["OrigHeight"].as_int(); sub.m_crop = Rect(point(cropx, cropy), Size(w, h)); } subImages.push_back(sub); rectnode = rectnode.next_sibling(); } if(!subImages.empty()) { // TODO: optimize multiple copy m_images.insert(std::make_pair(imgname, Image(this, imgname, Size(width, height), subImages, isAdditiveBlend))); } else { sys.logEvent(log::warning, std::string("The imageset ") + name + " can't find any rectangles for the image '" + imgname + "'. Skipping this image..."); } } imgnode = imgnode.next_sibling(); } return true; } return false; }