Exemple #1
0
/**
 * Reads the attributed object id, comments, and artifacts.
 */
bool Translator::ReadAttributedObject( AttributedObject& aobj, 
        Context& /*ctxt*/, const tinyxml2::XMLElement & elem, bool bIdAttributeRequired )
{
	//Grab the ID.
	pcstr szid = elem.Attribute("id");
	if( szid == NULL)
	{
		if( bIdAttributeRequired )
			throw GnssMetadata::TranslationException( "Required id attribute not defined.");
	}
	else
		aobj.Id(szid);

	//Parse the comments.
	const XMLElement* pelem = elem.FirstChildElement("comment");
	for( ;pelem != NULL; pelem = pelem->NextSiblingElement("comment"))
	{
		const char* szFmt = pelem->Attribute("format");
		Comment::CommentFormat fmt = (strcmp(szFmt, "text") == 0)
			? Comment::text : Comment::html;
		Comment comment( pelem->GetText(), fmt);
		aobj.Comments().push_back( comment);
	}

	//Parse the Artifacts.
	pelem = elem.FirstChildElement("artifact");
	for( ;pelem != NULL; pelem = pelem->NextSiblingElement("artifact"))
	{
		AnyUri auri( pelem->GetText());
		aobj.Artifacts().push_back( auri);
	}

	return true;
}
Exemple #2
0
UINT SciterViewCallback( LPSCITER_CALLBACK_NOTIFICATION pns, LPVOID callbackParam )
{
    switch(pns->code) {
        case SC_LOAD_DATA:
        {
            LPSCN_LOAD_DATA pc = LPSCN_LOAD_DATA(pns);
            aux::w2a auri(pc->uri);
            if( auri().like( "res:*" ) ) {
                LPCBYTE pdata; size_t data_length;
                if( get_layered_resource( auri.c_str() + 4, pdata, data_length ) )
                {
                    pc->outData = pdata;
                    pc->outDataSize = UINT(data_length);
                    return LOAD_OK;
                }
            }
            return LOAD_OK;
        }
        case SC_DATA_LOADED: break;
        case SC_ATTACH_BEHAVIOR: break;
    }
    return 0;
}