本文整理汇总了C++中Author类的典型用法代码示例。如果您正苦于以下问题:C++ Author类的具体用法?C++ Author怎么用?C++ Author使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Author类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testAuthor
void testAuthor() {
String *lname, *fname;
lname = new String("Erdos");
fname = new String("P.");
Author *n = new Author(fname, lname);
Set<Author> *targets = new Set<Author>();
Author *x, *k;
for (int i = 0; i < MAX_AUTHORS; i++) {
lname = new String(i);
fname = new String(i);
x = new Author(fname, lname);
n->publicouCom(x);
lname = new String(i);
fname = new String(i);
k = new Author(fname, lname);
x->publicouCom(k);
targets->add(k);
}
if (k != null) {
targets->add(k);
}
printf("targets %d\n", targets->size());
getchar();
Author::erdosPtr->process(targets);
}
示例2: doIt
void Worker::doIt()
{
Author author;
author.setName("someone");
QVERIFY(author.save());
emit done();
}
示例3: Author
/**
* Factory function
* \author Peter Grasch
*/
Author* Author::createAuthor(Scenario *parent, const QDomElement& elem)
{
Author *a = new Author(parent);
if (!a->deSerialize(elem)) {
delete a;
a=0;
}
return a;
}
示例4: main
int main(){
Author author = Author("Douglas", "Adams", 1952);
// Author { firstName: 'Douglas', lastName: 'Adams', yearBorn: 1952 }
author.firstName = "Doug";
// Author { firstName: 'Doug', lastName: 'Adams', yearBorn: 1952 }
string fullName = author.getFullName();
// "Doug Adams"
return 0;
}
示例5: show
void Publish::show()
{
Author *p = head;
while (p)
{
cout << "Name: " << p->getName() << endl;
cout << "Lastname: " << p->getLastname() << endl;
cout << "Type: Book" << endl;
cout << "Title: " << p->getTitle() << endl;
cout << "Number of pages: " << p->getKol() << endl;
p = p->next;
}
}
示例6: save
///@brief Adds author described in the form.
void AddAuthor::save()
{
if(!validateInput())
return;
Author a;
a.setFirstName(firstNameLineEdit->text());
a.setLastName(lastNameLineEdit->text());
a.setDescription(descriptionLineEdit->text());
a.setCritique(critiqueLineEdit->text());
a.setPicture(pictureLineEdit->text());
a.setRating(ratingWidget->getRating());
a.setThemes(getSelectedThemes());
try
{
c->insertAuthor(a);
}
catch(DataBaseException dbe)
{
MessageBoxDataBaseException q(&dbe, this);
q.appendText(tr("The author has not been added."));
q.exec();
}
emit closeRequested();
}
示例7: i18n
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();
}
示例8: authorsBooksRelation
void pgBook::addAuthorToBook(Book book, Author author)
{
pgAuthorsBooks authorsBooksRelation(this->driver);
data authorBookData;
authorBookData["author_id"] = author.getId();
authorBookData["book_id"] = book.getId();
AuthorsBooks item(authorBookData);
authorsBooksRelation.create(item);
}
示例9: testDataStructures
void testDataStructures(){
printf("number of unique authors: %d \n", (int)author_id_name.size());
printf("number of unique articles: %d \n", (int)article_id_art.size());
printf("created authors: %d \n", (int) authors.size());
Article * lastarticle = articles.back();
vector<string> lastauthors = lastarticle->authorsList();
for (int s=0; s < lastauthors.size(); s++) {
printf("author %d is: %s \n", s+1, lastauthors.at(s).c_str());
}
Author * lastauthor = authors.back();
vector<string> lastauthpubs = lastauthor->pubsList();
for (int p=0; p < lastauthpubs.size(); p++) {
printf("pubs %d is: %s \n", p+1, lastauthpubs.at(p).c_str());
}
}
示例10: displayBooks
void displayBooks(const vector<Book*>& books)
{
// set up cout to display currency
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);
// display heading
cout << "\nRecommended Reading List\n";
// you provide the rest of this code
// display each account
for (int i = 0; i < books.size(); i++)
{
Author* pointer = books[i]->getAuthor();
cout << books[i]->getTitle() << '\n';
cout << pointer->getName() << '\n';
cout << pointer->getAddress() << '\n';
cout << books[i]->getPages() << " pages\n";
// use rtti to see what kind of object is being pointed to, and display the
// appropriate child class data values
AudioBook* bp = dynamic_cast<AudioBook*>(books[i]);
if (bp)
{
cout << "The length of this audio book is " << bp->getAudioLength() << " minutes." << endl;
}
else
{
DigitalBook* bp = dynamic_cast<DigitalBook*>(books[i]);
if (bp)
{
cout << "The format of this digital book is " << bp->getFormat() << endl;
}
} // end else
cout << '$' << books[i]->getPrice() << "\n\n\n";
}
}
示例11: QWidget
AuthorDetails::AuthorDetails(Author &a, QWidget* parent): QWidget(parent)
{
setupUi(this);
firstName->setText(a.getFirstName());
lastName->setText(a.getLastName());
picture->setPixmap(QPixmap(a.getPicture()));
descriptionTextBrowser->setText(a.getDescription());
critiqueTextBrowser->setText(a.getCritique());
themes->setText(a.getThemesNames());
QString wikiLink = wikipediaLink->text();
QString lc = QLocale::system().name();
lc.truncate(2);
wikiLink.replace("<lc>", lc);
wikiLink.replace("<title>", a.getFirstName().append(a.getLastName()).replace(" ", "_"));
wikipediaLink->setText(wikiLink);
}
示例12: doc
//.........这里部分代码省略.........
Argument arg(parser->parseText(param->GetText()).c_str(),
brequired,
param->Attribute("desc"), true);
arg.setDefault(param->Attribute("default"));
module.addArgument(arg);
}
}
else
{
OSTRINGSTREAM war;
war<<"Unrecognized tag from "<<szFile<<" at line "\
<<param->Row()<<".";
logger->addWarning(war);
}
}
/* retrieving rank */
TiXmlElement* rank;
if((rank = (TiXmlElement*) root->FirstChild("rank")) &&
rank->GetText())
module.setRank(atoi(parser->parseText(rank->GetText()).c_str()));
/* 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(parser->parseText(ath->GetText()).c_str());
if(ath->Attribute("email"))
author.setEmail(ath->Attribute("email"));
module.addAuthor(author);
}
else
{
OSTRINGSTREAM war;
war<<"Unrecognized tag from "<<szFile<<" at line "\
<<ath->Row()<<".";
logger->addWarning(war);
}
}
/* retrieving data */
if(root->FirstChild("data"))
for(TiXmlElement* data = root->FirstChild("data")->FirstChildElement();
data; data = data->NextSiblingElement())
{
/* output data */
if(compareString(data->Value(), "output"))
{
OutputData output;
if(compareString(data->Attribute("port_type"), "stream") || !data->Attribute("port_type"))
output.setPortType(STREAM_PORT);
else if(compareString(data->Attribute("port_type"), "event"))
output.setPortType(EVENT_PORT);
else if(compareString(data->Attribute("port_type"), "service"))
示例13: ar
void Pretreatment::authorDatePretreat(string path)
{
int maxPc = 0, maxCn = 0;
double maxHi = 0, maxPi = 0, maxUpi = 0;
int minPc = INT_MAX, minCn = INT_MAX;
double minHi = DBL_MAX, minPi = DBL_MAX, minUpi = DBL_MAX;
AuthorReader ar(path);
Author au;
while(ar.getNextAuthor(au))
{
cout<<au.getIndex()<<endl;
if(au.getPc() < minPc && au.getPc() >= 0)
{
minPc = au.getPc();
}
if(au.getCn() < minCn && au.getCn() >= 0)
{
minCn = au.getCn();
}
if(au.getHi() < minHi && au.getHi() >= 0)
{
minHi = au.getHi();
}
if(au.getPi() < minPc && au.getPi() >= 0)
{
minPi = au.getPi();
}
if(au.getUpi() < minUpi && au.getUpi() >= 0)
{
minUpi = au.getUpi();
}
if(au.getPc() > maxPc)
{
maxPc = au.getPc();
}
if(au.getCn() > maxCn)
{
maxCn = au.getCn();
}
if(au.getHi() > maxHi)
{
maxHi = au.getHi();
}
if(au.getPi() > maxPi)
{
maxPi = au.getPi();
}
if(au.getUpi() > maxUpi)
{
maxUpi = au.getUpi();
}
}
ofstream fout;
fout.open("./authorResult", ios::out);
fout<<"minPc : "<<minPc<<" maxPc : "<<maxPc<<endl;
fout<<"minCn : "<<minCn<<" maxCn : "<<maxCn<<endl;
fout<<"minHi : "<<minHi<<" maxHi : "<<maxHi<<endl;
fout<<"minPi : "<<minPi<<" maxPi : "<<maxPi<<endl;
fout<<"minUpi : "<<minUpi<<" maxUpi : "<<maxUpi<<endl;
fout.close();
}
示例14: doc
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);
}
//.........这里部分代码省略.........
示例15: setValue
bool AuthorNode::setValue (const String& strMemberName, const String* pstrValue)
{
bool bValueSet = false;
Author* pObject = dynamic_cast<Author*>(m_pObject);
if (strMemberName == L"CreatedBy")
{
if (!pstrValue)
{
pObject->resetValue_CreatedBy();
}
else
{
pObject->setCreatedBy(StringObjectImpl::parseString(pstrValue->c_str(), pstrValue->length()));
bValueSet = true;
}
}
if (strMemberName == L"CreatedByEmail")
{
if (!pstrValue)
{
pObject->resetValue_CreatedByEmail();
}
else
{
pObject->setCreatedByEmail(StringObjectImpl::parseString(pstrValue->c_str(), pstrValue->length()));
bValueSet = true;
}
}
if (strMemberName == L"Company")
{
if (!pstrValue)
{
pObject->resetValue_Company();
}
else
{
pObject->setCompany(StringObjectImpl::parseString(pstrValue->c_str(), pstrValue->length()));
bValueSet = true;
}
}
if (strMemberName == L"CompanyURL")
{
if (!pstrValue)
{
pObject->resetValue_CompanyURL();
}
else
{
pObject->setCompanyURL(StringObjectImpl::parseString(pstrValue->c_str(), pstrValue->length()));
bValueSet = true;
}
}
if (strMemberName == L"TimeStamp")
{
if (!pstrValue)
{
pObject->resetValue_TimeStamp();
}
else
{
pObject->setTimeStamp(StringObjectImpl::parseString(pstrValue->c_str(), pstrValue->length()));
bValueSet = true;
}
}
return bValueSet;
}