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


C++ UT_String::c_str方法代码示例

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


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

示例1:

const char * AP_UnixPrefs::_getPrefsPathname(void) const
{
	/* return a pointer to a static buffer */
	static UT_String buf;

	if(!buf.empty())
	  return buf.c_str();

	const char * szDirectory = XAP_App::getApp()->getUserPrivateDirectory();
	const char * szFile = "AbiWord.Profile";

	buf = szDirectory;
	if (!buf.size() || szDirectory[buf.size()-1] != '/')
	  buf += "/";
	buf += szFile;

	return buf.c_str();
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:18,代码来源:ap_UnixPrefs.cpp

示例2: setBorderColor

void AP_Dialog_FormatTable::setBorderColor(UT_RGBColor clr)
{
    m_borderColor = clr;

    if (m_borderToggled)
        return;

    UT_String s = UT_String_sprintf("%02x%02x%02x", clr.m_red, clr.m_grn, clr.m_blu);

    m_vecProps.addOrReplaceProp("left-color", s.c_str());
    m_vecProps.addOrReplaceProp("right-color", s.c_str());
    m_vecProps.addOrReplaceProp("top-color", s.c_str());
    m_vecProps.addOrReplaceProp("bot-color", s.c_str());

    m_vecPropsAdjRight.addOrReplaceProp("left-color", s.c_str());
    m_vecPropsAdjBottom.addOrReplaceProp("top-color", s.c_str());

    m_bSettingsChanged = true;
}
开发者ID:tanya-guza,项目名称:abiword,代码行数:19,代码来源:ap_Dialog_FormatTable.cpp

示例3: openFootnote

void IE_Imp_WordPerfect::openFootnote(const WPXPropertyList & /*propList*/)
{
	if (m_bHdrFtrOpenCount) return; // HACK

	if (!m_bInSection)
	{
		X_CheckDocumentError(appendStrux(PTX_Section, NULL));
		X_CheckDocumentError(appendStrux(PTX_Block,NULL));
		m_bInSection = true;
	}

	const gchar** propsArray = NULL;
	
	UT_String footnoteId;
	UT_String_sprintf(footnoteId,"%i",UT_rand());	
	
	propsArray = static_cast<const gchar **>(UT_calloc(7, sizeof(gchar *)));
	propsArray [0] = "type";
	propsArray [1] = "footnote_ref";
	propsArray [2] = "footnote-id";
	propsArray [3] = footnoteId.c_str();
	propsArray [4] = NULL;
	propsArray [5] = NULL;
	propsArray [6] = NULL;
	X_CheckDocumentError(appendObject(PTO_Field, propsArray));

	const gchar * attribs[3] ={"footnote-id", footnoteId.c_str(), NULL};
	X_CheckDocumentError(appendStrux(PTX_SectionFootnote,attribs));
	
	X_CheckDocumentError(appendStrux(PTX_Block,NULL));
	m_bRequireBlock = false;

	propsArray = static_cast<const gchar **>(UT_calloc(7, sizeof(gchar *)));
	propsArray [0] = "type";
	propsArray [1] = "footnote_anchor";
	propsArray [2] = "footnote-id";
	propsArray [3] = footnoteId.c_str();
	propsArray [4] = NULL;
	propsArray [5] = NULL;
	propsArray [6] = NULL;
	X_CheckDocumentError(appendObject(PTO_Field, propsArray));
}
开发者ID:monkeyiq,项目名称:odf-2011-track-changes-git-svn,代码行数:42,代码来源:ie_imp_WordPerfect.cpp

示例4: g_strdup

char * XAP_Dialog_History::getListValue(UT_uint32 item, UT_uint32 column) const
{
	UT_return_val_if_fail(m_pDoc, NULL);

	UT_String S;
	time_t tT;
	struct tm * tM;
	char * s;
	
	switch(column)
	{
		case 0:
			UT_String_sprintf(S,"%d",m_pDoc->getHistoryNthId(item));
			return g_strdup(S.c_str());
			
		case 1:
			{
				tT = m_pDoc->getHistoryNthTimeStarted(item);
				tM = localtime(&tT);
				s = (char*)g_try_malloc(30);
				if(!s)
					return NULL;

				size_t len = strftime(s,30,"%c",tM);
				if(!len)
				{
					FREEP(s);
					return NULL;
				}

				return s;
			}

		case 2:
			{
				UT_return_val_if_fail(m_pSS, NULL);

				const char * pszS;
				if(m_pDoc->getHistoryNthAutoRevisioned(item))
					pszS = m_pSS->getValue(XAP_STRING_ID_DLG_MB_Yes);
				else
					pszS = m_pSS->getValue(XAP_STRING_ID_DLG_MB_No);
					
				UT_return_val_if_fail(pszS, NULL);

				return g_strdup(pszS);
			}
			
		default:;
	}

	UT_ASSERT(UT_SHOULD_NOT_HAPPEN);
	return NULL;
}
开发者ID:Distrotech,项目名称:abiword,代码行数:54,代码来源:xap_Dlg_History.cpp

示例5: s_check_changedDetails

static void s_check_changedDetails(GtkWidget * wid, AP_UnixDialog_FormatTOC * me)
{
	UT_UTF8String sProp = static_cast<char *> (g_object_get_data(G_OBJECT(wid),"toc-prop"));
	UT_UTF8String sVal = "1";
	if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(wid)) == FALSE)
	{
		sVal = "0";
	}
	UT_String sNum =  UT_String_sprintf("%d",me->getDetailsLevel());
	sProp += sNum.c_str();
	me->setTOCProperty(sProp,sVal);
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:12,代码来源:ap_UnixDialog_FormatTOC.cpp

示例6: str

UT_UTF8String UT_UTF8String_sprintf(const char * inFormat, ...)
{
  UT_String str ("");

  va_list args;
  va_start (args, inFormat);
  UT_String_vprintf (str, inFormat, args);
  va_end (args);

  // create & return a validated UTF-8 string based on the input
  return UT_UTF8String(str.c_str());
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:12,代码来源:ut_string_class.cpp

示例7: event_HasLabelChanged

void AP_UnixDialog_FormatTOC::event_HasLabelChanged(GtkWidget * wid)
{
	UT_UTF8String sProp = static_cast<char *> (g_object_get_data(G_OBJECT(wid),"toc-prop"));
	UT_String sNum =  UT_String_sprintf("%d",getMainLevel());
	sProp += sNum.c_str();
	UT_UTF8String sVal = "1";
	if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(wid)) == FALSE)
	{
		sVal = "0";
	}
	setTOCProperty(sProp,sVal);
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:12,代码来源:ap_UnixDialog_FormatTOC.cpp

示例8: GTK_WIDGET

GtkWidget * AP_UnixDialog_FormatTOC::_getWidget(const char * szNameBase, UT_sint32 iLevel)
{
	UT_return_val_if_fail(m_pBuilder, NULL);

	UT_String sLocal = szNameBase;
	if(iLevel > 0)
	{
		UT_String sVal = UT_String_sprintf("%d",iLevel);
		sLocal += sVal;
	}
	return GTK_WIDGET(gtk_builder_get_object(m_pBuilder, sLocal.c_str()));
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:12,代码来源:ap_UnixDialog_FormatTOC.cpp

示例9: _doEncodingDialog

/*!
  Request file encoding from user
 \param szEncoding Encoding to export file into

 This function should be identical to the one in ie_Imp_Text
 */
bool IE_Exp_Text::_doEncodingDialog(const char *szEncoding)
{
	XAP_Dialog_Id id = XAP_DIALOG_ID_ENCODING;

	XAP_DialogFactory * pDialogFactory
		= static_cast<XAP_DialogFactory *>(XAP_App::getApp()->getDialogFactory());

	XAP_Dialog_Encoding * pDialog
		= static_cast<XAP_Dialog_Encoding *>(pDialogFactory->requestDialog(id));
	UT_return_val_if_fail(pDialog, false);

	pDialog->setEncoding(szEncoding);

	// run the dialog
	XAP_Frame * pFrame = XAP_App::getApp()->getLastFocussedFrame();
	UT_return_val_if_fail(pFrame, false);

	pDialog->runModal(pFrame);

	// extract what they did

	bool bOK = (pDialog->getAnswer() == XAP_Dialog_Encoding::a_OK);

	if (bOK)
	{
		const gchar * s;
		static UT_String szEnc;

		s = pDialog->getEncoding();
		UT_return_val_if_fail (s, false);

		szEnc = s;
		_setEncoding(szEnc.c_str());
		getDoc()->setEncodingName(szEnc.c_str());
	}

	pDialogFactory->releaseDialog(pDialog);

	return bOK;
}
开发者ID:monkeyiq,项目名称:odf-2011-track-changes-git-svn,代码行数:46,代码来源:ie_exp_Text.cpp

示例10: findFont

GR_Font* GR_Graphics::findFont(const char* pszFontFamily,
                               const char* pszFontStyle,
                               const char* pszFontVariant,
                               const char* pszFontWeight,
                               const char* pszFontStretch,
                               const char* pszFontSize,
                               const char* pszLang)
{
    GR_Font * pFont = NULL;

    // NOTE: we currently favor a readable hash key to make debugging easier
    // TODO: speed things up with a smaller key (the three AP pointers?)
    UT_String key;

    UT_String_sprintf(key,"%s;%s;%s;%s;%s;%s",pszFontFamily, pszFontStyle, pszFontVariant, pszFontWeight, pszFontStretch, pszFontSize);
    GR_Font *pEntry = m_hashFontCache.pick(key.c_str());
    if (!pEntry)
    {
        // TODO -- note that we currently assume font-family to be a single name,
        // TODO -- not a list.  This is broken.

        pFont = _findFont(pszFontFamily, pszFontStyle,
                          pszFontVariant,pszFontWeight,
                          pszFontStretch, pszFontSize,
                          pszLang);
        UT_ASSERT(pFont);
        xxx_UT_DEBUGMSG(("Insert font %x in gr_Graphics cache \n",pFont));
        // add it to the cache

        if(pFont)
            m_hashFontCache.insert(key.c_str(), pFont);
    }
    else
    {
        pFont = pEntry;
    }
    return pFont;
}
开发者ID:tanya-guza,项目名称:abiword,代码行数:38,代码来源:gr_Graphics.cpp

示例11: setBackgroundColor

void AP_Dialog_FormatTable::setBackgroundColor(UT_RGBColor clr)
{
    UT_String bgcol = UT_String_sprintf("%02x%02x%02x", clr.m_red, clr.m_grn, clr.m_blu);

    m_vecProps.removeProp ("bg-style"); // Why do we remove this property?  We still use it in frames. -MG
    m_vecProps.removeProp ("bgcolor"); // this is only here for backward compatibility with AbiWord < 2.0. Could be removed as far as I can see - MARCM

    if (clr.isTransparent ())
        m_vecProps.removeProp ("background-color");
    else
        m_vecProps.addOrReplaceProp ("background-color", bgcol.c_str ());

    m_bSettingsChanged = true;
}
开发者ID:tanya-guza,项目名称:abiword,代码行数:14,代码来源:ap_Dialog_FormatTable.cpp

示例12: abiDialogSetTitle

/*!
 * Set the title of a gtk dialog
 */
void abiDialogSetTitle(GtkWidget * dlg, const char * title, ...)
{
  if ( title != NULL && strlen ( title ) )
  {
    UT_String titleStr ( "" ) ;

    va_list args;
    va_start (args, title);
    UT_String_vprintf (titleStr, title, args);
    va_end (args);

    // create the title
    gtk_window_set_title ( GTK_WINDOW(dlg), titleStr.c_str() ) ;
  }
}
开发者ID:Distrotech,项目名称:abiword,代码行数:18,代码来源:xap_UnixDialogHelper.cpp

示例13: findAbiSuiteLibFile

bool XAP_App::findAbiSuiteLibFile(UT_String & path, const char * filename, const char * subdir)
{
	if (!filename)
	{ 
		return false;
	}

	bool bFound = false;

	const char * dir = getUserPrivateDirectory();
	if (dir)
	{
		path = dir;
		if (subdir)
		{
			path += G_DIR_SEPARATOR;
			path += subdir;
		}
		path += G_DIR_SEPARATOR;
		path += filename;
		bFound = UT_isRegularFile (path.c_str ());
	}
	if (!bFound && (dir = getAbiSuiteLibDir()))
	{
		path = dir;
		if (subdir)
		{
			path += G_DIR_SEPARATOR;
			path += subdir;
		}
		path += G_DIR_SEPARATOR;
		path += filename;
		bFound = UT_isRegularFile (path.c_str ());
	}
	return bFound;
}
开发者ID:monkeyiq,项目名称:odf-2011-track-changes-git-svn,代码行数:36,代码来源:xap_App.cpp

示例14: setStyle

void AP_UnixDialog_FormatTOC::setStyle(GtkWidget * wid)
{
	UT_UTF8String sVal;
	GtkWidget * pLabel = static_cast<GtkWidget *> (g_object_get_data(G_OBJECT(wid),"display-widget"));
	UT_UTF8String sProp = static_cast<char *> (g_object_get_data(G_OBJECT(pLabel),"toc-prop"));
	if(g_ascii_strcasecmp("toc-heading-style",sProp.utf8_str()) != 0)
	{
		UT_String sNum =  UT_String_sprintf("%d",getMainLevel());
		sProp += sNum.c_str();
	}
	sVal = getNewStyle(sProp);
	gtk_label_set_text(GTK_LABEL(pLabel),sVal.utf8_str());
	setTOCProperty(sProp,sVal);
	applyTOCPropsToDoc();
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:15,代码来源:ap_UnixDialog_FormatTOC.cpp

示例15: ShowErrorBox

void AP_Dialog_FormatTable::ShowErrorBox(UT_String & sFile, UT_Error errorCode)
{
    XAP_String_Id String_id;
    XAP_Frame * pFrame = XAP_App::getApp()->getLastFocussedFrame();
    switch (errorCode)
    {
    case -301:
        String_id = AP_STRING_ID_MSG_IE_FileNotFound;
        break;

    case -302:
        String_id = AP_STRING_ID_MSG_IE_NoMemory;
        break;

    case -303:
        String_id = AP_STRING_ID_MSG_IE_UnsupportedType;
        //AP_STRING_ID_MSG_IE_UnknownType;
        break;

    case -304:
        String_id = AP_STRING_ID_MSG_IE_BogusDocument;
        break;

    case -305:
        String_id = AP_STRING_ID_MSG_IE_CouldNotOpen;
        break;

    case -306:
        String_id = AP_STRING_ID_MSG_IE_CouldNotWrite;
        break;

    case -307:
        String_id = AP_STRING_ID_MSG_IE_FakeType;
        break;

    case -311:
        String_id = AP_STRING_ID_MSG_IE_UnsupportedType;
        break;

    default:
        String_id = AP_STRING_ID_MSG_ImportError;
    }

    pFrame->showMessageBox(String_id,
                           XAP_Dialog_MessageBox::b_O,
                           XAP_Dialog_MessageBox::a_OK,
                           sFile.c_str());
}
开发者ID:tanya-guza,项目名称:abiword,代码行数:48,代码来源:ap_Dialog_FormatTable.cpp


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