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


C++ Book类代码示例

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


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

示例1: executeAsTransaction

bool BooksDB::saveBookStateStack(const Book &book, const std::deque<ReadingState> &stack) {
	if (!isInitialized() || book.bookId() == 0) {
		return false;
	}
	mySaveBookStateStack->setState(book.bookId(), stack);
	return executeAsTransaction(*mySaveBookStateStack);
}
开发者ID:temper8,项目名称:FBReader-Tizen,代码行数:7,代码来源:BooksDB.cpp

示例2: main

int main() 
{
    Book* book = xlCreateBook();
    if(book) 
    {         
        Font* font = book->addFont();
        font->setName(L"Impact");
        font->setSize(36);        

        Format* format = book->addFormat();
        format->setAlignH(ALIGNH_CENTER);
        format->setBorder(BORDERSTYLE_MEDIUMDASHDOTDOT);
        format->setBorderColor(COLOR_RED);
        format->setFont(font);
	               
        Sheet* sheet = book->addSheet(L"Custom");
        if(sheet)
        {
            sheet->writeStr(2, 1, L"Format", format);
            sheet->setCol(1, 1, 25);
        }

        if(book->save(L"format.xls")) 
        {
            ::ShellExecute(NULL, L"open", L"format.xls", NULL, NULL, SW_SHOW);
        }
    }
    
    return 0;
}
开发者ID:icune,项目名称:R,代码行数:30,代码来源:format.cpp

示例3: getPatron

/*******************************************************
**requestBook Description:
**	if the specified Book is not in the Library, return
**		"book not found"
**	if the specified Patron is not in the Library, return
**		"patron not found"
**	if the specified Book is already requested by another
**		Patron, return "book on hold by other patron"
**	update the Book's requestedBy; if the Book is on the
**		shelf, update its location to on hold; return
**		"request successful"
*******************************************************/
string Library::requestBook(std::string pID, std::string bID)
{
	//find if Book exists//
	if (getBook(bID) == NULL)
		return "Book not found.";
	
	//find if Patron exists//
	if (getPatron(pID) == NULL)
		return "Patron not found.";

	//set Book's requestedBy and/or location//
	//based on current location//
	if (getBook(bID)->getLocation() == ON_HOLD_SHELF)
		return "Book on hold by another Patron.";
	else
	{
		//initiate local pointers if Book is not already on hold//
		Patron* pPtr = getPatron(pID);
		Book* bPtr = getBook(bID);

		//set Book's requestedBy and location//
		bPtr->setRequestedBy(pPtr);
		if (bPtr->getLocation() == ON_SHELF)
		{
			bPtr->setLocation(ON_HOLD_SHELF);
		}

		//request was successful//
		return "Request successful.";
	}
}
开发者ID:brownnr,项目名称:C-and-Cpp,代码行数:43,代码来源:Library.cpp

示例4:

 bool operator ==(const Book& other) {
     if(this->getTitle()==other.getTitle()&&this->getBookLength()
             ==other.getBookLength()) {
         return true;
     } else
         return false;
 }
开发者ID:scottdreyer32,项目名称:C-code,代码行数:7,代码来源:BookShelf.cpp

示例5: Generate

std::string InventoryReport::Generate() {
    ClassificationService classificationService;

    vector<Record> records;

    vector<Holding>* holdings = Catalog::Holdings();
    for (vector<Holding>::iterator it = holdings->begin();
        it != holdings->end();
        it++)
    {
        Holding holding = *it;
        Book book = classificationService.RetrieveDetails(holding.Classification());
        if (book.Type() == Book::TYPE_BOOK)
        {
            Record record(book, holding.CurrentBranch().Name(), mIsbnApi);
            records.push_back(record);
        }
    }


    sort(records.begin(), records.end());

    stringstream buffer;
    AppendHeader(buffer);
    AppendColumnHeaders(buffer);
    for (vector<Record>::iterator it = records.begin(); it != records.end();it++)
         Append(buffer, *it);
    AppendFooter(buffer);
    return buffer.str();
}
开发者ID:MrRoboto99,项目名称:cpptdd,代码行数:30,代码来源:InventoryReport.cpp

示例6: findBook

// Finds successor to a book
// Finds the book, gets the book with max value for the right sub-tree
Book* Library::successor(double price, Book *book) {
    Book* tmp = findBook(price, book);
    if ( tmp ) {
        return max(tmp->getRight(tmp));
    }
    return 0;
}
开发者ID:rsgoss,项目名称:softwareengineering,代码行数:9,代码来源:Tree.cpp

示例7: deleteFromBookList

bool BooksDB::deleteFromBookList(const Book &book) {
	if (book.bookId() == 0) {
		return false;
	}
	((DBIntValue&)*myDeleteBookList->parameter("@book_id").value()) = book.bookId();
	return myDeleteBookList->execute();
}
开发者ID:temper8,项目名称:FBReader-Tizen,代码行数:7,代码来源:BooksDB.cpp

示例8: scope

void BookWrap::Each(const FunctionCallbackInfo<Value>& args) {
    Isolate* isolate = args.GetIsolate();
    HandleScope scope(isolate);

    Book* book = ObjectWrap::Unwrap<BookWrap>(args.This())->m_book;

    if (args.Length() == 1) {
        if (args[0]->IsFunction()) {
            Local<Function> fun = Local<Function>::Cast(args[0]);
            for(uint32_t i = 0; i < book->size(); ++i) {
                Local<Object> pw = PersonWrap::New(isolate, book, i);
                Local<Value> argv[1] = { pw };
                fun->Call(Null(isolate), 1, argv);
            }
            args.GetReturnValue().SetUndefined();
            return;
        }
        else {
            isolate->ThrowException(Exception::TypeError(String::NewFromUtf8(isolate, "Function expected")));
            args.GetReturnValue().SetUndefined();
            return;
        }
    }
    else {
        isolate->ThrowException(Exception::TypeError(String::NewFromUtf8(isolate, "One argument expected")));
        args.GetReturnValue().SetUndefined();
        return;
            
    }
}
开发者ID:kneth,项目名称:DemoNodeExtension,代码行数:30,代码来源:book_wrap.cpp

示例9: ExportAnyData

int ExportAnyData(CString filename, vector<string> &orders)
{
	Book* book = xlCreateBook();
	if(!book)
		return 0;

	for(vector<string>::iterator it = orders.begin(); it != orders.end(); it++)
	{
		CString Filename = it->c_str();
		Filename += ".xml";
		TiXmlElement *Root = getXMLRoot(Filename);
		Sheet* sheet = book->addSheet(it->c_str());
		if(!sheet)
			return 0;
		addOneSheet(sheet, Root);

		delete Root->GetDocument();
	}

	if(book->save(_T(filename.GetBuffer(0)) )) 
	{
		return 1;
	}
	else
	{
		return 0;
	}

	book->release();
}
开发者ID:tiancode,项目名称:liuyang,代码行数:30,代码来源:mmlAnyExportDlg.cpp

示例10: detectLanguage

void FormatPlugin::detectLanguage(Book &book, ZLInputStream &stream) {
	std::string language = book.language();
	if (!language.empty()) {
		return;
	}

	PluginCollection &collection = PluginCollection::Instance();
	if (language.empty()) {
		language = collection.DefaultLanguageOption.value();
	}
	if (collection.LanguageAutoDetectOption.value() && stream.open()) {
		static const int BUFSIZE = 65536;
		char *buffer = new char[BUFSIZE];
		const size_t size = stream.read(buffer, BUFSIZE);
		stream.close();
		shared_ptr<ZLLanguageDetector::LanguageInfo> info =
			ZLLanguageDetector().findInfo(buffer, size);
		delete[] buffer;
		if (!info.isNull()) {
			if (!info->Language.empty()) {
				language = info->Language;
			}
		}
	}
	book.setLanguage(language);
}
开发者ID:OpenInkpot-archive,项目名称:fbreader,代码行数:26,代码来源:FormatPlugin.cpp

示例11: GetBook

//Puts a book on the hold shelf, unless it is already requested.
//If checked out, note that it should go to the hold shelf
void Library::requestBook(std::string patronID, std::string bookID)
{
    Book* book = GetBook(bookID);
    Patron* patron = GetPatron(patronID);

    if(book == NULL || patron == NULL)
    {
        if(book == NULL)
        {
            std::cout << std::endl << "No such book in holdings." << std::endl;
        }
        if(patron == NULL)
        {
            std::cout << std::endl << "No such patron in records." << std::endl;
        }
        return;
    }

    if(book->getRequestedBy() == NULL)
    {
        book->setRequestedBy(patron);
        if(book->getLocation() == ON_SHELF)
        {
            book->setLocation(ON_HOLD);
        }
    }
    else
    {
        std::cout << "This book is already requested!";
    }
}
开发者ID:nathansoz,项目名称:cs161-final,代码行数:33,代码来源:Library.cpp

示例12: detectLanguage

bool FormatPlugin::detectLanguage(Book &book, ZLInputStream &stream, const std::string &encoding, bool force) {
	std::string language = book.language();
	if (!force && !language.empty()) {
		return true;
	}

	bool detected = false;

	PluginCollection &collection = PluginCollection::Instance();
	if (collection.isLanguageAutoDetectEnabled() && stream.open()) {
		static const int BUFSIZE = 65536;
		char *buffer = new char[BUFSIZE];
		const std::size_t size = stream.read(buffer, BUFSIZE);
		stream.close();
		shared_ptr<ZLLanguageDetector::LanguageInfo> info =
			ZLLanguageDetector().findInfoForEncoding(encoding, buffer, size, -20000);
		delete[] buffer;
		if (!info.isNull()) {
			detected = true;
			if (!info->Language.empty()) {
				language = info->Language;
			}
		}
	}
	book.setLanguage(language);

	return detected;
}
开发者ID:04k,项目名称:FBReaderJ,代码行数:28,代码来源:FormatPlugin.cpp

示例13: insertIntoBookList

bool BooksDB::insertIntoBookList(const Book &book) {
	if (book.bookId() == 0) {
		return false;
	}
	((DBIntValue&)*myInsertBookList->parameter("@book_id").value()) = book.bookId();
	return myInsertBookList->execute();
}
开发者ID:temper8,项目名称:FBReader-Tizen,代码行数:7,代码来源:BooksDB.cpp

示例14: detectEncodingAndLanguage

void FormatPlugin::detectEncodingAndLanguage(Book &book, ZLInputStream &stream) {
	std::string language = book.language();
	std::string encoding = book.encoding();
	if (!encoding.empty() && !language.empty()) {
		return;
	}

	PluginCollection &collection = PluginCollection::Instance();
	if (language.empty()) {
		language = collection.DefaultLanguageOption.value();
	}
	if (encoding.empty()) {
		encoding = collection.DefaultEncodingOption.value();
	}
	if (collection.LanguageAutoDetectOption.value() && stream.open()) {
		static const int BUFSIZE = 65536;
		char *buffer = new char[BUFSIZE];
		const size_t size = stream.read(buffer, BUFSIZE);
		stream.close();
		shared_ptr<ZLLanguageDetector::LanguageInfo> info =
			ZLLanguageDetector().findInfo(buffer, size);
		delete[] buffer;
		if (!info.isNull()) {
			if (!info->Language.empty()) {
				language = info->Language;
			}
			encoding = info->Encoding;
			if ((encoding == "US-ASCII") || (encoding == "ISO-8859-1")) {
				encoding = "windows-1252";
			}
		}
	}
	book.setEncoding(encoding);
	book.setLanguage(language);
}
开发者ID:OpenInkpot-archive,项目名称:fbreader,代码行数:35,代码来源:FormatPlugin.cpp

示例15: main

int main()
{
    Book book;
    book.print();

    return 0;
}
开发者ID:haozlee,项目名称:pimpl,代码行数:7,代码来源:main.cpp


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