本文整理汇总了C++中SPDocument::getURI方法的典型用法代码示例。如果您正苦于以下问题:C++ SPDocument::getURI方法的具体用法?C++ SPDocument::getURI怎么用?C++ SPDocument::getURI使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SPDocument
的用法示例。
在下文中一共展示了SPDocument::getURI方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: set
/**
* Callback: set attribute.
*/
void ColorProfile::set(unsigned key, gchar const *value) {
switch (key) {
case SP_ATTR_XLINK_HREF:
if ( this->href ) {
g_free( this->href );
this->href = 0;
}
if ( value ) {
this->href = g_strdup( value );
if ( *this->href ) {
#if HAVE_LIBLCMS1
cmsErrorAction( LCMS_ERROR_SHOW );
#endif
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
// TODO open filename and URIs properly
//FILE* fp = fopen_utf8name( filename, "r" );
//LCMSAPI cmsHPROFILE LCMSEXPORT cmsOpenProfileFromMem(LPVOID MemPtr, cmsUInt32Number dwSize);
// Try to open relative
SPDocument *doc = this->document;
if (!doc) {
doc = SP_ACTIVE_DOCUMENT;
g_warning("this has no document. using active");
}
//# 1. Get complete URI of document
gchar const *docbase = doc->getURI();
gchar* escaped = g_uri_escape_string(this->href, "!*'();:@=+$,/?#[]", TRUE);
//g_message("docbase:%s\n", docbase);
//org::w3c::dom::URI docUri(docbase);
Inkscape::URI docUri("");
if (docbase) { // The file has already been saved
docUri = Inkscape::URI::from_native_filename(docbase);
}
//# 2. Get href of icc file. we don't care if it's rel or abs
//org::w3c::dom::URI hrefUri(escaped);
Inkscape::URI hrefUri(escaped);
//# 3. Resolve the href according the docBase. This follows
// the w3c specs. All absolute and relative issues are considered
std::string fullpath = hrefUri.getFullPath(docUri.getFullPath(""));
gchar* fullname = g_uri_unescape_string(fullpath.c_str(), "");
this->impl->_clearProfile();
this->impl->_profHandle = cmsOpenProfileFromFile( fullname, "r" );
if ( this->impl->_profHandle ) {
this->impl->_profileSpace = cmsGetColorSpace( this->impl->_profHandle );
this->impl->_profileClass = cmsGetDeviceClass( this->impl->_profHandle );
}
DEBUG_MESSAGE( lcmsOne, "cmsOpenProfileFromFile( '%s'...) = %p", fullname, (void*)this->impl->_profHandle );
g_free(escaped);
escaped = 0;
g_free(fullname);
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
}
}
this->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
case SP_ATTR_LOCAL:
if ( this->local ) {
g_free( this->local );
this->local = 0;
}
this->local = g_strdup( value );
this->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
case SP_ATTR_NAME:
if ( this->name ) {
g_free( this->name );
this->name = 0;
}
this->name = g_strdup( value );
DEBUG_MESSAGE( lcmsTwo, "<color-profile> name set to '%s'", this->name );
this->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
case SP_ATTR_RENDERING_INTENT:
if ( this->intentStr ) {
g_free( this->intentStr );
this->intentStr = 0;
}
this->intentStr = g_strdup( value );
if ( value ) {
if ( strcmp( value, "auto" ) == 0 ) {
this->rendering_intent = RENDERING_INTENT_AUTO;
} else if ( strcmp( value, "perceptual" ) == 0 ) {
this->rendering_intent = RENDERING_INTENT_PERCEPTUAL;
} else if ( strcmp( value, "relative-colorimetric" ) == 0 ) {
this->rendering_intent = RENDERING_INTENT_RELATIVE_COLORIMETRIC;
} else if ( strcmp( value, "saturation" ) == 0 ) {
this->rendering_intent = RENDERING_INTENT_SATURATION;
} else if ( strcmp( value, "absolute-colorimetric" ) == 0 ) {
//.........这里部分代码省略.........