本文整理汇总了C++中FROM_UTF8函数的典型用法代码示例。如果您正苦于以下问题:C++ FROM_UTF8函数的具体用法?C++ FROM_UTF8怎么用?C++ FROM_UTF8使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FROM_UTF8函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FROM_UTF8
void CVPCB_MAINFRAME::refreshAfterComponentSearch( COMPONENT* component )
{
// Tell AuiMgr that objects are changed !
if( m_auimgr.GetManagedWindow() ) // Be sure Aui Manager is initialized
// (could be not the case when starting CvPcb
m_auimgr.Update();
if( component == NULL )
return;
// Preview of the already assigned footprint.
// Find the footprint that was already chosen for this component and select it,
// but only if the selection is made from the component list or the library list.
// If the selection is made from the footprint list, do not change the current
// selected footprint.
if( FindFocus() == m_compListBox || FindFocus() == m_libListBox )
{
wxString module = FROM_UTF8( component->GetFPID().Format().c_str() );
bool found = false;
for( int ii = 0; ii < m_footprintListBox->GetCount(); ii++ )
{
wxString footprintName;
wxString msg = m_footprintListBox->OnGetItemText( ii, 0 );
msg.Trim( true );
msg.Trim( false );
footprintName = msg.AfterFirst( wxChar( ' ' ) );
if( module.Cmp( footprintName ) == 0 )
{
m_footprintListBox->SetSelection( ii, true );
found = true;
break;
}
}
if( !found )
{
int ii = m_footprintListBox->GetSelection();
if ( ii >= 0 )
m_footprintListBox->SetSelection( ii, false );
if( GetFootprintViewerFrame() )
{
CreateScreenCmp();
}
}
}
SendMessageToEESCHEMA();
DisplayStatus();
}
示例2: DisplayInfoMessage
MODULE* DISPLAY_FOOTPRINTS_FRAME::Get_Module( const wxString& aFootprintName )
{
MODULE* footprint = NULL;
try
{
FPID fpid;
if( fpid.Parse( aFootprintName ) >= 0 )
{
DisplayInfoMessage( this, wxString::Format( wxT( "Footprint ID <%s> is not valid." ),
GetChars( aFootprintName ) ) );
return NULL;
}
std::string nickname = fpid.GetLibNickname();
std::string fpname = fpid.GetFootprintName();
wxLogDebug( wxT( "Load footprint <%s> from library <%s>." ),
fpname.c_str(), nickname.c_str() );
footprint = Prj().PcbFootprintLibs()->FootprintLoad(
FROM_UTF8( nickname.c_str() ), FROM_UTF8( fpname.c_str() ) );
}
catch( const IO_ERROR& ioe )
{
DisplayError( this, ioe.errorText );
return NULL;
}
if( footprint )
{
footprint->SetParent( (EDA_ITEM*) GetBoard() );
footprint->SetPosition( wxPoint( 0, 0 ) );
return footprint;
}
wxString msg = wxString::Format( _( "Footprint '%s' not found" ), aFootprintName.GetData() );
DisplayError( this, msg );
return NULL;
}
示例3: CopasiWidget
/*
* Constructs a CQSpeciesDetail which is a child of 'parent', with the
* name 'name'.'
*/
CQSpeciesDetail::CQSpeciesDetail(QWidget* parent, const char* name) :
CopasiWidget(parent, name),
mChanged(false),
mInitialNumberLastChanged(true),
mpMetab(NULL),
mpCurrentCompartment(NULL),
mItemToType(),
mInitialNumber(0.0),
mInitialConcentration(0.0),
mExpressionValid(false),
mInitialExpressionValid(false)
{
setupUi(this);
mpComboBoxType->insertItem(FROM_UTF8(CModelEntity::StatusName[CModelEntity::REACTIONS]));
mpComboBoxType->insertItem(FROM_UTF8(CModelEntity::StatusName[CModelEntity::FIXED]));
mpComboBoxType->insertItem(FROM_UTF8(CModelEntity::StatusName[CModelEntity::ASSIGNMENT]));
mpComboBoxType->insertItem(FROM_UTF8(CModelEntity::StatusName[CModelEntity::ODE]));
mItemToType.push_back(CModelEntity::REACTIONS);
mItemToType.push_back(CModelEntity::FIXED);
mItemToType.push_back(CModelEntity::ASSIGNMENT);
mItemToType.push_back(CModelEntity::ODE);
// assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
// int Width = fontMetrics().width("Concentration (" +
// FROM_UTF8((*CCopasiRootContainer::getDatamodelList())[0]->getModel()->getConcentrationUnitsDisplayString()) +
// ")");
//
// mpLblValue->setMinimumWidth(Width);
mpExpressionEMW->mpExpressionWidget->setExpressionType(CQExpressionWidget::TransientExpression);
mpInitialExpressionEMW->mpExpressionWidget->setExpressionType(CQExpressionWidget::InitialExpression);
mpReactionTable->verticalHeader()->hide();
mpReactionTable->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
mpReactionTable->horizontalHeader()->hide();
mpReactionTable->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);
}
示例4: while
bool SCH_BUS_ENTRY_BASE::Load( LINE_READER& aLine, wxString& aErrorMsg,
SCH_ITEM **out )
{
char Name1[256];
char Name2[256];
char* line = (char*) aLine;
*out = NULL;
while( (*line != ' ' ) && *line )
line++;
if( sscanf( line, "%255s %255s", Name1, Name2 ) != 2 )
{
aErrorMsg.Printf( wxT( "Eeschema file bus entry load error at line %d" ),
aLine.LineNumber() );
aErrorMsg << wxT( "\n" ) << FROM_UTF8( (char*) aLine );
return false;
}
SCH_BUS_ENTRY_BASE *this_new;
if( Name1[0] == 'B' )
this_new = new SCH_BUS_BUS_ENTRY;
else
this_new = new SCH_BUS_WIRE_ENTRY;
*out = this_new;
if( !aLine.ReadLine() || sscanf( (char*) aLine, "%d %d %d %d ",
&this_new->m_pos.x, &this_new->m_pos.y,
&this_new->m_size.x, &this_new->m_size.y ) != 4 )
{
aErrorMsg.Printf( wxT( "Eeschema file bus entry load error at line %d" ),
aLine.LineNumber() );
aErrorMsg << wxT( "\n" ) << FROM_UTF8( (char*) aLine );
return false;
}
this_new->m_size.x -= this_new->m_pos.x;
this_new->m_size.y -= this_new->m_pos.y;
return true;
}
示例5: Files
void CQExperimentData::slotFileAdd()
{
QString File =
CopasiFileDialog::getOpenFileName(this,
"Open File Dialog",
"",
"Data Files (*.txt *.csv);;All Files (*)",
"Open Data Files");
if (File.isNull()) return;
std::map<std::string, std::string>::const_iterator it = mFileMap.begin();
std::map<std::string, std::string>::const_iterator end = mFileMap.end();
int i;
for (; it != end; ++it)
if (it->second == TO_UTF8(File))
{
for (i = 0; i < mpBoxFile->count(); i++)
if (it->first == TO_UTF8(mpBoxFile->item(i)->text()))
{
mpBoxFile->setCurrentRow(i);
break;
}
return;
}
std::string FileName = CDirEntry::fileName(TO_UTF8(File));
i = 0;
while (mFileMap.find(FileName) != mFileMap.end())
FileName = StringPrint("%s_%d", CDirEntry::fileName(TO_UTF8(File)).c_str(), i++);
mFileMap[FileName] = TO_UTF8(File);
mpBoxFile->addItem(FROM_UTF8(FileName));
mpBoxFile->setCurrentRow(mpBoxFile->count() - 1);
size_t First, Last;
if (mpFileInfo->getFirstUnusedSection(First, Last))
{
do
{
slotExperimentAdd();
}
while (mpBtnExperimentAdd->isEnabled());
mpBoxExperiment->setCurrentRow(0);
}
}
示例6: setAxisTitle
void CopasiPlot::setAxisUnits(const C_INT32 & index,
const CCopasiObject * pObject)
{
if (pObject == NULL) return;
std::string Units = pObject->getUnits();
if (Units != "")
setAxisTitle(index, FROM_UTF8(Units));
return;
}
示例7: QVariant
QVariant CQReferenceDM::data(const QModelIndex &index, int role) const
{
if (!index.isValid())
return QVariant();
if (index.row() >= rowCount())
return QVariant();
if (role == Qt::DisplayRole || role == Qt::EditRole)
{
if (isDefaultRow(index))
{
if (index.column() == COL_RESOURCE_REFERENCE)
return QVariant(QString("-- select --"));
else if (index.column() == COL_ROW_NUMBER)
return QVariant(QString(""));
else
return QVariant(QString(""));
}
else
{
switch (index.column())
{
case COL_ROW_NUMBER:
return QVariant(index.row() + 1);
case COL_RESOURCE_REFERENCE:
return QVariant(QString(FROM_UTF8(mpMIRIAMInfo->getReferences()[index.row()].getResource())));
case COL_ID_REFERENCE:
return QVariant(QString(FROM_UTF8(mpMIRIAMInfo->getReferences()[index.row()].getId())));
case COL_DESCRIPTION:
return QVariant(QString(FROM_UTF8(mpMIRIAMInfo->getReferences()[index.row()].getDescription())));
}
}
}
return QVariant();
}
示例8: assert
// virtual
void CScanWidgetScan::load(const CCopasiParameterGroup * pItem)
{
if (pItem == NULL) return;
*mpData = *pItem;
void * tmp;
if (!(tmp = mpData->getValue("Type").pVOID)) return;
CScanProblem::Type type = *(CScanProblem::Type*)tmp;
if (type != CScanProblem::SCAN_LINEAR)
return;
if (!(tmp = mpData->getValue("Number of steps").pVOID)) return;
lineEditNumber->setText(QString::number(*(C_INT32*)tmp));
if (!(tmp = mpData->getValue("Object").pVOID)) return;
std::string tmpString = *(std::string*)tmp;
if (tmpString == "")
mpObject = NULL;
else
{
assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
CCopasiDataModel* pDataModel = (*CCopasiRootContainer::getDatamodelList())[0];
assert(pDataModel != NULL);
mpObject = pDataModel->getDataObject(tmpString);
}
if (mpObject)
lineEditObject->setText(FROM_UTF8(mpObject->getObjectDisplayName()));
else
lineEditObject->setText("");
if (!(tmp = mpData->getValue("Minimum").pVOID)) return;
lineEditMin->setText(QString::number(*(C_FLOAT64*)tmp));
if (!(tmp = mpData->getValue("Maximum").pVOID)) return;
lineEditMax->setText(QString::number(*(C_FLOAT64*)tmp));
if (!(tmp = mpData->getValue("log").pVOID)) return;
checkBoxLog->setChecked(*(bool*)tmp);
return;
}
示例9: load
void CQCompartment::load()
{
if (mpCompartment == NULL) return;
//Dimensionality
mpComboBoxDim->setCurrentIndex(mpCompartment->getDimensionality());
// slotDimesionalityChanged(mpCompartment->getDimensionality());
// Simulation Type
mpComboBoxType->setCurrentIndex(mpComboBoxType->findText(FROM_UTF8(CModelEntity::StatusName[mpCompartment->getStatus()])));
// Initial Volume
mpEditInitialVolume->setText(convertToQString(mpCompartment->getInitialValue()));
// Transient Volume
mpEditCurrentVolume->setText(convertToQString(mpCompartment->getValue()));
// Concentration Rate
mpEditRate->setText(convertToQString(mpCompartment->getRate()));
// Expression
mpExpressionEMW->mpExpressionWidget->setExpression(mpCompartment->getExpression());
mpExpressionEMW->updateWidget();
// Initial Expression
mpInitialExpressionEMW->mpExpressionWidget->setExpression(mpCompartment->getInitialExpression());
mpInitialExpressionEMW->updateWidget();
// Noise Expression
mpNoiseExpressionWidget->mpExpressionWidget->setExpression(mpCompartment->getNoiseExpression());
mpNoiseExpressionWidget->updateWidget();
mpBoxAddNoise->setChecked(mpCompartment->hasNoise());
// Type dependent display of values
slotTypeChanged(mpComboBoxType->currentText());
// Use Initial Expression
if (mpCompartment->getStatus() == CModelEntity::Status::ASSIGNMENT ||
mpCompartment->getInitialExpression() == "")
{
mpBoxUseInitialExpression->setChecked(false);
}
else
{
mpBoxUseInitialExpression->setChecked(true);
}
loadMetaboliteTable();
mChanged = false;
return;
}
示例10: load
void CQModelWidget::load()
{
if (mpModel == NULL)
return;
mpComboTimeUnit->setCurrentIndex(mpComboTimeUnit->findText(FROM_UTF8(mpModel->getTimeUnitName())));
mpComboVolumeUnit->setCurrentIndex(mpComboVolumeUnit->findText(FROM_UTF8(mpModel->getVolumeUnitName())));
mpComboQuantityUnit->setCurrentIndex(mpComboQuantityUnit->findText(FROM_UTF8(mpModel->getQuantityUnitName())));
mpComboAreaUnit->setCurrentIndex(mpComboAreaUnit->findText(FROM_UTF8(mpModel->getAreaUnitName())));
mpComboLengthUnit->setCurrentIndex(mpComboLengthUnit->findText(FROM_UTF8(mpModel->getLengthUnitName())));
mpCheckStochasticCorrection->setChecked(mpModel->getModelType() == CModel::deterministic);
mpLblInitialTime->setText("Initial Time (" + mpComboTimeUnit->currentText() + ")");
mpEditInitialTime->setText(QString::number(mpModel->getInitialTime()));
mpEditInitialTime->setReadOnly(mpModel->isAutonomous());
mpLblCurrentTime->setText("Time (" + mpComboTimeUnit->currentText() + ")");
mpEditCurrentTime->setText(QString::number(mpModel->getTime()));
return;
}
示例11: if
void CQNotes::load()
{
if (mpObject != NULL)
{
const std::string * pNotes = NULL;
if (dynamic_cast< CModelEntity * >(mpObject))
pNotes = &static_cast< CModelEntity * >(mpObject)->getNotes();
else if (dynamic_cast< CEvent * >(mpObject))
pNotes = &static_cast< CEvent * >(mpObject)->getNotes();
else if (dynamic_cast< CReaction * >(mpObject))
pNotes = &static_cast< CReaction * >(mpObject)->getNotes();
else if (dynamic_cast< CFunction * >(mpObject))
pNotes = &static_cast< CFunction * >(mpObject)->getNotes();
else if (dynamic_cast< CReportDefinition * >(mpObject))
pNotes = & static_cast< CReportDefinition * >(mpObject)->getComment();
if (pNotes != NULL)
{
// The notes are UTF8 encoded however the html does not specify an encoding
// thus Qt uses locale settings.
mpWebView->setHtml(FROM_UTF8(*pNotes));
mpEdit->setPlainText(FROM_UTF8(*pNotes));
mpValidatorXML->saved();
slotValidateXML();
if (!mpValidatorXML->isFreeText() && mEditMode)
{
slotToggleMode();
}
mValidity = QValidator::Acceptable;
}
}
mChanged = false;
return;
}
示例12: CopasiWidget
/*
* Constructs a CQCompartment which is a child of 'parent', with the
* name 'name'.'
*/
CQCompartment::CQCompartment(QWidget* parent, const char* name):
CopasiWidget(parent, name),
mItemToType(),
mpCompartment(NULL),
mChanged(false),
mExpressionValid(true),
mInitialExpressionValid(true)
{
setupUi(this);
mpComboBoxType->insertItem(mpComboBoxType->count(), FROM_UTF8(CModelEntity::StatusName[CModelEntity::FIXED]));
mpComboBoxType->insertItem(mpComboBoxType->count(), FROM_UTF8(CModelEntity::StatusName[CModelEntity::ASSIGNMENT]));
mpComboBoxType->insertItem(mpComboBoxType->count(), FROM_UTF8(CModelEntity::StatusName[CModelEntity::ODE]));
mItemToType.push_back(CModelEntity::FIXED);
mItemToType.push_back(CModelEntity::ASSIGNMENT);
mItemToType.push_back(CModelEntity::ODE);
mpMetaboliteTable->horizontalHeader()->hide();
mExpressionValid = false;
mpExpressionEMW->mpExpressionWidget->setExpressionType(CQExpressionWidget::TransientExpression);
mInitialExpressionValid = false;
mpInitialExpressionEMW->mpExpressionWidget->setExpressionType(CQExpressionWidget::InitialExpression);
#ifdef COPASI_EXTUNIT
mpLblDim->show();
mpComboBoxDim->show();
#else
mpLblDim->hide();
mpComboBoxDim->hide();
#endif
#ifdef COPASI_UNDO
CopasiUI3Window * pWindow = dynamic_cast<CopasiUI3Window * >(parent->parent());
setUndoStack(pWindow->getUndoStack());
#endif
}
示例13: sendCommand
void MyIrcSession::on_connected() {
m_connected = true;
if (suffix.empty()) {
np->handleConnected(user);
// if (!sentList) {
// sendCommand(IrcCommand::createList("", ""));
// sentList = true;
// }
}
// sendCommand(IrcCommand::createCapability("REQ", QStringList("away-notify")));
for(AutoJoinMap::iterator it = m_autoJoin.begin(); it != m_autoJoin.end(); it++) {
sendCommand(IrcCommand::createJoin(FROM_UTF8(it->second->getChannel()), FROM_UTF8(it->second->getPassword())));
}
if (getIdentify().find(" ") != std::string::npos) {
std::string to = getIdentify().substr(0, getIdentify().find(" "));
std::string what = getIdentify().substr(getIdentify().find(" ") + 1);
sendCommand(IrcCommand::createMessage(FROM_UTF8(to), FROM_UTF8(what)));
}
}
示例14: MyIrcSession
MyIrcSession *IRCNetworkPlugin::createSession(const std::string &user, const std::string &hostname, const std::string &nickname, const std::string &password, const std::string &suffix) {
MyIrcSession *session = new MyIrcSession(user, this, suffix);
session->setUserName(FROM_UTF8(nickname));
session->setNickName(FROM_UTF8(nickname));
session->setRealName(FROM_UTF8(nickname));
session->setHost(FROM_UTF8(hostname));
session->setPort(6667);
// session->setEncoding("UTF8");
if (!password.empty()) {
std::string identify = m_identify;
boost::replace_all(identify, "$password", password);
boost::replace_all(identify, "$name", nickname);
session->setIdentify(identify);
}
LOG4CXX_INFO(logger, user << ": Connecting " << hostname << " as " << nickname << ", suffix=" << suffix);
session->open();
return session;
}
示例15: LOG4CXX_WARN
void SingleIRCNetworkPlugin::handleMessageSendRequest(const std::string &user, const std::string &legacyName, const std::string &message, const std::string &/*xhtml*/) {
if (m_sessions[user] == NULL) {
LOG4CXX_WARN(logger, user << ": Message received for unconnected user");
return;
}
// handle PMs
std::string r = legacyName;
if (legacyName.find("/") == std::string::npos) {
r = legacyName.substr(0, r.find("@"));
}
else {
r = legacyName.substr(legacyName.find("/") + 1);
}
LOG4CXX_INFO(logger, user << ": Forwarding message to " << r);
m_sessions[user]->sendCommand(IrcCommand::createMessage(FROM_UTF8(r), FROM_UTF8(message)));
if (r.find("#") == 0) {
handleMessage(user, legacyName, message, TO_UTF8(m_sessions[user]->nickName()));
}
}