本文整理汇总了C++中Author::setName方法的典型用法代码示例。如果您正苦于以下问题:C++ Author::setName方法的具体用法?C++ Author::setName怎么用?C++ Author::setName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Author
的用法示例。
在下文中一共展示了Author::setName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doIt
void Worker::doIt()
{
Author author;
author.setName("someone");
QVERIFY(author.save());
emit done();
}
示例2: slotOk
void UploadDialog::slotOk()
{
if (mNameEdit->text().isEmpty()) {
KMessageBox::error(this, i18n("Please put in a name."));
//return;
reject(); // FIXME - huh? return should work here but it accept()s!
}
QString language = m_languages.value(mLanguageCombo->currentText());
Author author;
author.setName(mAuthorEdit->text());
author.setEmail(mEmailEdit->text());
KTranslatable previewurl;
KUrl purl = mPreviewUrl->url();
//purl.setFileName(QString());
// FIXME: what does this do?
previewurl.addString(language, purl.url());
KTranslatable summary;
summary.addString(language, mSummaryEdit->toPlainText());
KTranslatable name;
name.addString(language, mNameEdit->text());
m_entry = new Entry;
m_entry->setName(name);
m_entry->setAuthor(author);
m_entry->setVersion(mVersionEdit->text());
m_entry->setLicense(mLicenseCombo->currentText());
m_entry->setPreview(previewurl);
m_entry->setSummary(summary);
if (mPayloadUrl.isValid()) {
KConfigGroup cg(KGlobal::config(), QString("KNewStuffUpload:%1").arg(mPayloadUrl.fileName()));
cg.writeEntry("name", mNameEdit->text());
cg.writeEntry("author", mAuthorEdit->text());
cg.writeEntry("author-email", mEmailEdit->text());
cg.writeEntry("version", mVersionEdit->text());
cg.writeEntry("license", mLicenseCombo->currentText());
cg.writeEntry("preview", mPreviewUrl->url().url());
cg.writeEntry("summary", mSummaryEdit->toPlainText());
cg.writeEntry("language", mLanguageCombo->currentText());
KGlobal::config()->sync();
}
accept();
}
示例3: parsXml
Application* XmlAppLoader::parsXml(const char* szFile)
{
app.clear();
ErrorLogger* logger = ErrorLogger::Instance();
TiXmlDocument doc(szFile);
if(!doc.LoadFile())
{
OSTRINGSTREAM err;
err<<"Syntax error while loading "<<szFile<<" at line "\
<<doc.ErrorRow()<<": ";
err<<doc.ErrorDesc();
logger->addError(err);
return NULL;
}
/* retrieving root element */
TiXmlElement *root = doc.RootElement();
if(!root)
{
OSTRINGSTREAM err;
err<<"Syntax error while loading "<<szFile<<" . ";
err<<"No root element.";
logger->addError(err);
return NULL;
}
if(!compareString(root->Value(), "application"))
{
//OSTRINGSTREAM err;
//err<<"File "<<szFile<<" has no tag <application>.";
//logger->addError(err);
return NULL;
}
/* retrieving name */
TiXmlElement* name = (TiXmlElement*) root->FirstChild("name");
if(!name || !name->GetText())
{
OSTRINGSTREAM err;
err<<"Module from "<<szFile<<" has no name.";
logger->addError(err);
//return NULL;
}
app.setXmlFile(szFile);
if(name)
{
string strname = name->GetText();
for(unsigned int i=0; i<strname.size(); i++)
if(strname[i] == ' ')
strname[i] = '_';
app.setName(strname.c_str());
}
/* retrieving description */
TiXmlElement* desc;
if((desc = (TiXmlElement*) root->FirstChild("description")))
app.setDescription(desc->GetText());
/* retrieving version */
TiXmlElement* ver;
if((ver = (TiXmlElement*) root->FirstChild("version")))
app.setVersion(ver->GetText());
/*
* TODO: setting prefix of the main application is inactivated.
* Check this should be supported in future or not!
*/
/*
//retrieving application prefix
TiXmlElement* pref;
if((pref = (TiXmlElement*) root->FirstChild("prefix")))
app.setPrefix(pref->GetText());
*/
/* retrieving authors information*/
TiXmlElement* authors;
if((authors = (TiXmlElement*) root->FirstChild("authors")))
for(TiXmlElement* ath = authors->FirstChildElement(); ath;
ath = ath->NextSiblingElement())
{
if(compareString(ath->Value(), "author"))
{
Author author;
if(ath->GetText())
author.setName(ath->GetText());
if(ath->Attribute("email"))
author.setEmail(ath->Attribute("email"));
app.addAuthor(author);
}
else
{
OSTRINGSTREAM war;
war<<"Unrecognized tag from "<<szFile<<" at line "\
<<ath->Row()<<".";
logger->addWarning(war);
}
//.........这里部分代码省略.........
示例4: parsXml
Module* XmlModLoader::parsXml(const char* szFile)
{
module.clear();
ErrorLogger* logger = ErrorLogger::Instance();
TiXmlDocument doc(szFile);
if(!doc.LoadFile())
{
OSTRINGSTREAM err;
err<<"Syntax error while loading "<<szFile<<" at line "\
<<doc.ErrorRow()<<": ";
err<<doc.ErrorDesc();
logger->addError(err);
return nullptr;
}
/* retrieving root module */
TiXmlElement *root = doc.RootElement();
if(!root)
{
OSTRINGSTREAM err;
err<<"Syntax error while loading "<<szFile<<" . ";
err<<"No root element.";
logger->addError(err);
return nullptr;
}
if(!compareString(root->Value(), "module"))
{
/*
OSTRINGSTREAM msg;
msg<<szFile<<" is not a module descriptor file.";
logger->addWarning(msg);
*/
return nullptr;
}
/* retrieving name */
auto* name = (TiXmlElement*) root->FirstChild("name");
if(!name || !name->GetText())
{
OSTRINGSTREAM err;
err<<"Module from "<<szFile<<" has no name.";
logger->addError(err);
//return NULL;
}
for(TiXmlElement* var = root->FirstChildElement("var"); var; var = var->NextSiblingElement())
{
if(var->Attribute("name") && var->GetText())
{
parser->addVariable(var->Attribute("name"), var->GetText());
}
}
module.setXmlFile(szFile);
if(name)
module.setName(parser->parseText(name->GetText()).c_str());
/* retrieving description */
TiXmlElement* desc;
if((desc = (TiXmlElement*) root->FirstChild("description")))
module.setDescription(parser->parseText(desc->GetText()).c_str());
/* retrieving version */
TiXmlElement* ver;
if((ver = (TiXmlElement*) root->FirstChild("version")))
module.setVersion(parser->parseText(ver->GetText()).c_str());
/* retrieving parameter */
TiXmlElement* arguments;
if((arguments = (TiXmlElement*) root->FirstChild("arguments")))
for(TiXmlElement* param = arguments->FirstChildElement(); param;
param = param->NextSiblingElement())
{
if(compareString(param->Value(), "param"))
{
if(param->GetText())
{
bool brequired = false;
if(compareString(param->Attribute("required"), "yes"))
brequired = true;
Argument arg(parser->parseText(param->GetText()).c_str(),
brequired,
param->Attribute("desc"));
arg.setDefault(param->Attribute("default"));
module.addArgument(arg);
}
}
else
if(compareString(param->Value(), "switch"))
{
if(param->GetText())
{
bool brequired = false;
if(compareString(param->Attribute("required"), "yes"))
brequired = true;
Argument arg(parser->parseText(param->GetText()).c_str(),
//.........这里部分代码省略.........