当前位置: 首页>>代码示例>>C++>>正文


C++ UT_String类代码示例

本文整理汇总了C++中UT_String的典型用法代码示例。如果您正苦于以下问题:C++ UT_String类的具体用法?C++ UT_String怎么用?C++ UT_String使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了UT_String类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: UT_DEBUGMSG

void ODi_Frame_ListenerState::_drawInlineImage (const gchar** ppAtts)
{
    const gchar* pWidth = NULL;
    const gchar* pHeight = NULL;
    UT_String dataId;

    m_inlinedImage = true;

    if(!m_rAbiData.addImageDataItem(dataId, ppAtts)) {
        UT_DEBUGMSG(("ODT import: no suitable image importer found\n"));
        return;
    }

    UT_String propsBuffer;
        
    pWidth = m_rElementStack.getStartTag(0)->getAttributeValue("svg:width");
    UT_ASSERT(pWidth);
        
    pHeight = m_rElementStack.getStartTag(0)->getAttributeValue("svg:height");
    UT_ASSERT(pHeight);  
        
    UT_String_sprintf(propsBuffer, "width:%s; height:%s", pWidth, pHeight);
        
	m_mPendingImgProps["props"] = propsBuffer.c_str();
	m_mPendingImgProps["dataid"] = dataId.c_str();

	// don't write the image out yet as we might get more properties, for
	// example alt descriptions from the <svg:desc> tag
	m_bInlineImagePending = true;
}
开发者ID:Distrotech,项目名称:abiword,代码行数:30,代码来源:ODi_Frame_ListenerState.cpp

示例2: utSuffix

IEFileType IE_Imp::fileTypeForSuffixes(const char * suffixList)
{
	IEFileType ieft = IEFT_Unknown;
	if (!suffixList)
		return ieft;

	UT_String utSuffix (suffixList);
	const size_t len = strlen(suffixList);
	size_t i = 0;

	while (true)
		{
			while (i < len && suffixList[i] != '.')
				i++;

			// will never have all-space extension

			const size_t start = i;
			while (i < len && suffixList[i] != ';')
				i++;

			if (i <= len) {
				UT_String suffix (utSuffix.substr(start, i-start).c_str());
				UT_DEBUGMSG(("DOM: suffix: %s\n", suffix.c_str()));
				
				ieft = fileTypeForSuffix (suffix.c_str());
				if (ieft != IEFT_Unknown || i == len)
					return ieft;
				
				i++;
			}
		}
	return ieft;
}
开发者ID:monkeyiq,项目名称:odf-2011-track-changes-git-svn,代码行数:34,代码来源:ie_imp.cpp

示例3: UT_A2W

//========================  FUNCTION DECLARATION  =====================
// FCT NAME :    UT_A2W
//---------------------------------------------------------------------
/// \param pSrc 
/// \return 
//---------------------------------------------------------------------
// DESCRIPTION :
/// Convert ascii to a 'wstring'.
//=====================================================================
void UT_A2W( const char *pSrc, UT_String &dst)
{
#if defined(TARGET_IOS) || defined(TARGET_MACOS)
  CFStringRef	strref = CFStringCreateWithCStringNoCopy( 0, pSrc, CFStringGetSystemEncoding(), kCFAllocatorNull );
  dst = UT_String( strref );
  CFRelease( strref );
  
  size_t uLen = strlen( pSrc );
  dst.resize( uLen );
  UT_String::iterator it = dst.begin();
  
  while( *pSrc )
  {
    *it = wchar_t( *pSrc );
    ++it;
    ++pSrc;
  }
#else
   dst = UT_String();
  if (!pSrc)
    return;
  while (*pSrc)
  {
    dst.push_back(UniChar_t(*pSrc));
    ++pSrc;
  }

#endif
}
开发者ID:griffin-harris,项目名称:GameProject,代码行数:38,代码来源:UT_String.cpp

示例4: startRender

int ROP_SceneCacheWriter::startRender( int nframes, fpreal s, fpreal e )
{
	UT_String value;
	evalString( value, pRootObject.getToken(), 0, 0 );
	
	try
	{
		SceneInterface::Path emptyPath;
		m_liveScene = new IECoreHoudini::HoudiniScene( value, emptyPath, emptyPath );
	}
	catch ( IECore::Exception &e )
	{		
		addError( ROP_MESSAGE, e.what() );
		return false;
	}
	
	evalString( value, pFile.getToken(), 0, 0 );
	std::string file = value.toStdString();
	
	try
	{
		m_outScene = SceneInterface::create( file, IndexedIO::Write );
	}
	catch ( IECore::Exception &e )
	{
		addError( ROP_MESSAGE, ( "Could not create a writable IECore::SceneInterface at \"" + file + "\"" ).c_str() );
		return false;
	}
	
	return true;
}
开发者ID:Alwnikrotikz,项目名称:cortex-vfx,代码行数:31,代码来源:ROP_SceneCacheWriter.cpp

示例5: GTK_COMBO_BOX

void AP_UnixDialog_FormatTOC::s_NumType_changed(GtkWidget * wid, 
												AP_UnixDialog_FormatTOC * me )
{

	GtkTreeIter iter;
	GtkComboBox * combo = GTK_COMBO_BOX(wid);
	gtk_combo_box_get_active_iter(combo, &iter);
	GtkTreeModel *store = gtk_combo_box_get_model(combo);
	UT_UTF8String sProp;
	if(wid == me->m_wLabelChoose) {
		sProp = "toc-label-type";
	}
	else if (wid == me->m_wPageNumberingChoose) {
		sProp = "toc-page-type";
	}
	else {
		UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN);
	}
	char * value2;
	gtk_tree_model_get(store, &iter, 2, &value2, -1);

	UT_UTF8String sVal = value2;
	UT_String sNum =  UT_String_sprintf("%d",me->getDetailsLevel());
	sProp += sNum.c_str();
	me->setTOCProperty(sProp,sVal);
	g_free(value2);
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:27,代码来源:ap_UnixDialog_FormatTOC.cpp

示例6: _errorSAXFunc

static void _errorSAXFunc(void *xmlp,
			  const char *msg,
			  ...)
{
  va_list args;
  va_start (args, msg);
  UT_String errorMessage;
  UT_String_vprintf (errorMessage,msg, args);
  va_end (args);
  // Handle 'nbsp' here
  UT_XML * pXML = reinterpret_cast<UT_XML *>(xmlp);
  pXML->incMinorErrors();
  char * szErr = g_strdup(errorMessage.c_str() );
  if(strstr(szErr,"'nbsp' not defined") != NULL)
  {
    UT_DEBUGMSG(("nbsp found in stream errs %d \n",pXML->getNumMinorErrors()));
      pXML->incRecoveredErrors();
      const char buffer []= { (char)0xa0};
      pXML->charData(buffer,1); 
  }
  else if(strstr(szErr,"not defined") != NULL)
  {
      pXML->incRecoveredErrors();
  }
  else
  {
      UT_DEBUGMSG(("SAX function error here \n"));
      UT_DEBUGMSG(("%s", errorMessage.c_str()));
// This is a runtime error, an ASSERT is out of place.
//      UT_ASSERT(UT_SHOULD_NOT_HAPPEN);
  }
  FREEP(szErr);
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:33,代码来源:ut_xml_libxml2.cpp

示例7: URLDict_invoke

//
// URLDict_invoke
// -------------------
//   This is the function that we actually call to invoke the on-line dictionary.
//   It should be called when the user selects from the context menu
//
static bool 
URLDict_invoke(AV_View* /*v*/, EV_EditMethodCallData * /*d*/)
{
  // Get the current view that the user is in.
  XAP_Frame *pFrame = XAP_App::getApp()->getLastFocussedFrame();
  FV_View* pView = static_cast<FV_View*>(pFrame->getCurrentView());
  
  // If the user is on a word, but does not have it selected, we need
  // to go ahead and select that word so that the search/replace goes
  // correctly.
  pView->moveInsPtTo(FV_DOCPOS_EOW_MOVE);
  pView->moveInsPtTo(FV_DOCPOS_BOW);
  pView->extSelTo(FV_DOCPOS_EOW_SELECT);   
  
  // Now we will figure out what word to look up when we open our dialog.
  UT_String url ("http://www.dict.org/bin/Dict?Form=Dict1&Database=*&Strategy=*&Query=");
  if (!pView->isSelectionEmpty())
    {
      // We need to get the Ascii version of the current word.
      UT_UCS4Char *ucs4ST;
      pView->getSelectionText(*&ucs4ST);
      char* search = _ucsToAscii(
				 ucs4ST
				 );
      
      url += search;
      DELETEPV(search);
      FREEP(ucs4ST);
    }

  XAP_App::getApp()->openURL( url.c_str() ); 

  return true;
}
开发者ID:Distrotech,项目名称:abiword,代码行数:40,代码来源:AbiURLDict.cpp

示例8: UT_DEBUGMSG

void  AP_UnixDialog_FormatTOC::event_Apply(void)
{
	UT_DEBUGMSG(("Doing apply \n"));

// Heading Text

	GtkWidget * pW = _getWidget("edHeadingText");
	UT_UTF8String sVal;
	sVal = gtk_entry_get_text(GTK_ENTRY(pW));
	setTOCProperty("toc-heading",sVal.utf8_str());

// Text before and after

	pW = _getWidget("edTextAfter");
	sVal = gtk_entry_get_text(GTK_ENTRY(pW));
	UT_UTF8String sProp;
	sProp = static_cast<const char *> (g_object_get_data(G_OBJECT(pW),"toc-prop"));
	UT_String sNum =  UT_String_sprintf("%d",getDetailsLevel());
	sProp += sNum.c_str();
	setTOCProperty(sProp,sVal);

	pW = _getWidget("edTextBefore");
	sVal = gtk_entry_get_text(GTK_ENTRY(pW));
	sProp = static_cast<const char *> (g_object_get_data(G_OBJECT(pW),"toc-prop"));
	sProp += sNum.c_str();
	setTOCProperty(sProp,sVal);
	Apply();
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:28,代码来源:ap_UnixDialog_FormatTOC.cpp

示例9: doRegistration

bool doRegistration(void)
{
    // Get XAP_Prefs object for retrieving/storing image editor and related preferences
    UT_return_val_if_fail(prefs != NULL, false);
    if ((prefsScheme = prefs->getPluginScheme(szAbiPluginSchemeName)) == NULL)
    {
      // it may not exist so try creating & adding it.
      prefs->addPluginScheme(new XAP_PrefsScheme(prefs, szAbiPluginSchemeName));
	// if it still isn't there then fail
      if ((prefsScheme = prefs->getPluginScheme(szAbiPluginSchemeName)) == NULL)
        return false;

	// go ahead and set our default values
	UT_String szProgramName;
	bool bLeaveImageAsPNG;
	getDefaultApp(szProgramName, bLeaveImageAsPNG);
	prefsScheme->setValue(ABIPAINT_PREF_KEY_szProgramName.c_str(), szProgramName.c_str());
	prefsScheme->setValueBool(ABIPAINT_PREF_KEY_bLeaveImageAsPNG, bLeaveImageAsPNG);
    }


    // Add the image editor to AbiWord's menus.
    addToMenus(amo, NUM_MENUITEMS, AP_MENU_ID_TOOLS_WORDCOUNT, AP_MENU_ID_FMT_IMAGE);


    return true;
}
开发者ID:Distrotech,项目名称:abiword,代码行数:27,代码来源:AbiPaint.cpp

示例10: DECLARE_ABI_PLUGIN_METHOD

//
// AbiPaint specify image editor
// -------------------
//   This is the function sets which image editor will (at least attempted) be invoked.
//
//   parameters are:
//     AV_View* v
//     EV_EditMethodCallData *d)
//
static DECLARE_ABI_PLUGIN_METHOD(specify)
{
	UT_UNUSED(v);
	UT_UNUSED(d);
	// get current value
	UT_String szProgramName = "";
	prefsScheme->getValue(ABIPAINT_PREF_KEY_szProgramName, szProgramName);

	// Get a frame in case we need to show an error message
	XAP_Frame *pFrame = XAP_App::getApp()->getLastFocussedFrame();

	{
		const char * szDescList[3];
		const char * szSuffixList[3];
		int ft[3];
		szDescList[0] = szProgramsDesc;
		szSuffixList[0] = szProgramSuffix;
		szDescList[1] = szSuffixList[1] = NULL;
		ft[0] = ft[1] = ft[2] = IEGFT_Unknown;

		if (getFileName(szProgramName, pFrame, XAP_DIALOG_ID_FILE_OPEN, szDescList, szSuffixList, ft))
			return false;

		UT_DEBUGMSG(("ABIPAINT: szProgramName to use is  %s\n", szProgramName.c_str()));
	}
	
	// now write it to the preference
	prefsScheme->setValue(ABIPAINT_PREF_KEY_szProgramName.c_str(), szProgramName.c_str());

	return true;
}
开发者ID:Distrotech,项目名称:abiword,代码行数:40,代码来源:AbiPaint.cpp

示例11: UT_String_getPropVal

/*!
 * Assuming a string of standard abiword properties eg. "fred:nerk; table-width:1.0in; table-height:10.in"
 * Return the value of the property sProp or NULL if it is not present.
 * This UT_String * should be deleted by the calling programming after it is finished with it.
 */
UT_String UT_String_getPropVal(const UT_String & sPropertyString, const UT_String & sProp)
{
	UT_String sWork(sProp);
	sWork += ":";

	const char * szWork = sWork.c_str();
	const char * szProps = sPropertyString.c_str();
	const char * szLoc = strstr(szProps,szWork);
	if(szLoc == NULL)
	{
		return UT_String();
	}
//
// Look if this is the last property in the string.
//
	const char * szDelim = strchr(szLoc,';');
	if(szDelim == NULL)
	{
//
// Remove trailing spaces
//
		UT_sint32 iSLen = strlen(szProps);
		while(iSLen > 0 && szProps[iSLen-1] == ' ')
		{
			iSLen--;
		}
//
// Calculate the location of the substring
//
		UT_sint32 offset = static_cast<UT_sint32>(reinterpret_cast<size_t>(szLoc) - reinterpret_cast<size_t>(szProps));
		offset += strlen(szWork);
		return UT_String(sPropertyString.substr(offset,(iSLen - offset)));
	}
	else
	{
		szDelim = strchr(szLoc,';');
		if(szDelim == NULL)
		{
//
// bad property string
//
			UT_ASSERT(UT_SHOULD_NOT_HAPPEN);
			return UT_String();
		}
//
// Remove trailing spaces.
//
		while(*szDelim == ';' || *szDelim == ' ')
		{
			szDelim--;
		}
//
// Calculate the location of the substring
//
		UT_sint32 offset = static_cast<UT_sint32>(reinterpret_cast<size_t>(szLoc) - reinterpret_cast<size_t>(szProps));
		offset += strlen(szWork);
		UT_sint32 iLen = static_cast<UT_sint32>(reinterpret_cast<size_t>(szDelim) - reinterpret_cast<size_t>(szProps)) + 1;
		return UT_String(sPropertyString.substr(offset,(iLen - offset)));
	}
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:65,代码来源:ut_string_class.cpp

示例12: XAP_comboBoxGetActiveInt

void XAP_UnixDialog_FileOpenSaveAs::fileTypeChanged(GtkWidget * w)
{
    if (!m_bSave)
        return;

    UT_sint32 nFileType = XAP_comboBoxGetActiveInt(GTK_COMBO_BOX(w));
    UT_DEBUGMSG(("File type widget is %p filetype number is %d \n",w,nFileType));
    // I have no idea for 0, but XAP_DIALOG_FILEOPENSAVEAS_FILE_TYPE_AUTO
    // definitely means "skip this"
    if((nFileType == 0) || (nFileType == XAP_DIALOG_FILEOPENSAVEAS_FILE_TYPE_AUTO))
    {
        return;
    }

    gchar * filename = gtk_file_chooser_get_filename(m_FC);
    UT_String sFileName = filename;
    FREEP(filename);

    UT_String sSuffix = m_szSuffixes[nFileType-1];
    sSuffix = sSuffix.substr(1,sSuffix.length()-1);
    UT_sint32 i = 0;
    bool bFoundComma = false;
    for(i=0; i< static_cast<UT_sint32>(sSuffix.length()); i++)
    {
        if(sSuffix[i] == ';')
        {
            bFoundComma = true;
            break;
        }
    }
    if(bFoundComma)
    {
        sSuffix = sSuffix.substr(0,i);
    }

//
// Hard code a suffix
//
    if(strstr(sSuffix.c_str(),"gz") != NULL)
    {
        sSuffix = ".zabw";
    }
    bool bFoundSuffix = false;
    for(i= sFileName.length()-1; i> 0; i--)
    {
        if(sFileName[i] == '.')
        {
            bFoundSuffix = true;
            break;
        }
    }
    if(!bFoundSuffix)
    {
        return;
    }
    sFileName = sFileName.substr(0,i);
    sFileName += sSuffix;

    gtk_file_chooser_set_current_name(m_FC, UT_basename(sFileName.c_str()));
}
开发者ID:monkeyiq,项目名称:odf-2011-track-changes-git-svn,代码行数:60,代码来源:xap_UnixDlg_FileOpenSaveAs.cpp

示例13: _runConversion

	UT_Error _runConversion(const UT_String& pdf_on_disk, const UT_String& output_on_disk, size_t which)
	{
		UT_Error rval = UT_ERROR;

		const char * pdftoabw_argv[4];
		
		int argc = 0;
		pdftoabw_argv[argc++] = pdf_conversion_programs[which].conversion_program;
		pdftoabw_argv[argc++] = pdf_on_disk.c_str ();
		pdftoabw_argv[argc++] = output_on_disk.c_str ();
		pdftoabw_argv[argc++] = NULL;
		
		// run conversion
		if (g_spawn_sync (NULL,
						  (gchar **)pdftoabw_argv,
						  NULL,
						  (GSpawnFlags)(G_SPAWN_SEARCH_PATH | G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL),
						  NULL,
						  NULL,
						  NULL,
						  NULL,
						  NULL,
						  NULL))
			{
				char * uri = UT_go_filename_to_uri (output_on_disk.c_str ());
				if (uri)
					{
						// import the document
						rval = IE_Imp::loadFile (getDoc (), uri, IE_Imp::fileTypeForSuffix (pdf_conversion_programs[which].extension));
						g_free (uri);
					}
			}

		return rval;
	}
开发者ID:hfiguiere,项目名称:abiword,代码行数:35,代码来源:ie_imp_PDF.cpp

示例14: UT_ASSERT

bool fp_FieldTOCListLabelRun::calculateValue(void)
{
    UT_UCSChar sz_ucs_FieldValue[FPFIELD_MAX_LENGTH + 1];
//
// First get owning TOC.
//
    UT_ASSERT(getLength() == 0);
    fl_TOCLayout * pTOCL = static_cast<fl_TOCLayout *>(getBlock()->myContainingLayout());
    UT_ASSERT(pTOCL->getContainerType() == FL_CONTAINER_TOC);
    UT_String str = pTOCL->getTOCListLabel(getBlock()).utf8_str();
    if(str.size() == 0)
    {
        sz_ucs_FieldValue[0] = 0;
        return _setValue(sz_ucs_FieldValue);
    }
    UT_sint32 i = 0;
    bool bStop = false;
    for(i=0; (i<FPFIELD_MAX_LENGTH) && !bStop; i++)
    {
        sz_ucs_FieldValue[i] = static_cast<UT_UCSChar>(str[i]);
        if(str[i] == 0)
        {
            bStop = true;
        }
    }
    return _setValue(sz_ucs_FieldValue);
}
开发者ID:tanya-guza,项目名称:abiword,代码行数:27,代码来源:fp_FieldTOCNum.cpp

示例15: initSimulationOPs

int
ROP_partio::startRender(int nframes, fpreal tstart, fpreal tend)
{
    int	rcode = 1;
    myEndTime = tend;
    myStartTime = tstart;
	UT_String filename;


		OUTPUTRAW(filename, 0);
		if(filename.isstring()==0) 
		{
				addError(ROP_MESSAGE, "ROP can't write to invalid path");
				return ROP_ABORT_RENDER;
		}

    if (INITSIM())
    {
        initSimulationOPs();
		OPgetDirector()->bumpSkipPlaybarBasedSimulationReset(1);
    }

    if (error() < UT_ERROR_ABORT)
    {
		if( !executePreRenderScript(tstart) )
	    return 0;
    }

		

    return rcode;
}
开发者ID:milo-green,项目名称:partio,代码行数:32,代码来源:ROP_partio.C


注:本文中的UT_String类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。