コード例 #1
0
ファイル: helpctrl.cpp プロジェクト: iokto/newton-dynamics
bool wxHtmlHelpController::Initialize(const wxString& file)
{
    wxString dir, filename, ext;
    wxFileName::SplitPath(file, & dir, & filename, & ext);

    if (!dir.empty())
        dir = dir + wxFILE_SEP_PATH;

    // Try to find a suitable file
    wxString actualFilename = dir + filename + wxString(wxT(".zip"));
    if (!wxFileExists(actualFilename))
    {
        actualFilename = dir + filename + wxString(wxT(".htb"));
        if (!wxFileExists(actualFilename))
        {
            actualFilename = dir + filename + wxString(wxT(".hhp"));
            if (!wxFileExists(actualFilename))
            {
#if wxUSE_LIBMSPACK
                actualFilename = dir + filename + wxString(wxT(".chm"));
                if (!wxFileExists(actualFilename))
#endif
                    return false;
            }
        }
    }
    return AddBook(wxFileName(actualFilename));
}
コード例 #2
0
ファイル: interface.cpp プロジェクト: desire2020/Lisperarian
int procFunc(int p)
{
    int message;
    if (CheckAuthority(p, inOperation))
    switch(p)
    {
        case 0 : message = SignIn(); break;
        case 1 : message = Login(); break;
        case -2 : message = Finalization(); break;
        case 2 : message = Logout(); break;
        case -3 : message = SearchBookByKeyword();break;
        case 3 : message = BorBook(); break;
        case 4 : message = RetBook(); break;
		case -4 : message = ShowSpecificBook(); break;
        case 5 : message = ChangeNickName(); break;
        case 6 : message = ChangePassword(); break;
        case 7 : message = AddBook(); break;
        case 8 : message = DelBook(); break;
        case 9 : message = EditBook(); break;
        case 10 : message = DelUser(); break;
        case -10 : message = 0; break;
        case 11 : message = ChangeUserAuthority(); break;
        default : break;
    }
    return message;
}
コード例 #3
0
ファイル: Task2_z_7.cpp プロジェクト: BojkoRoman/Task2_z_7
int main()
{
   unsigned char chr;


	do
	{
		if(!top)cout<<"1. Add new books"<<endl;	
		if(top) cout<<"2. Print information about all books sort by year"<<endl;
		if(top) cout<<"3. Print information about the C/C++ books"<<endl;
		cout<<"4. Exit\n"<<endl;
		cout<<"Enter command : "<<endl;
		cin>>chr; 
		switch(chr)
		{
			case '1':
						cout<<"-------------------------------"<<endl;
						cout<<"Enter information about  books"<<endl;	
						cout<<"(end of entering - 0)"<<endl;	
						cout<<"-------------------------------"<<endl;

							do
							{ 
							  last=AddBook(last);
							} while (last!=NULL);
							
					    break;
			case '2':
				        if(top)
						{
						  SortByYear();
						  PrintAllBooks(top);
				        }
				        break;
			case '3':
				        if(top)
				        {
					      PrintC(top);
				        }
				        break;
	    }
		cout<<endl;
	}
	while(chr != '4');
 FreeList ( top );
	
  system("pause");
  return 0;
}
コード例 #4
0
void main(){
	char * SearchMsg[] = { "찾기성공", "삭제 등록된 데이터가 없습니다.", "찾으려는 데이터가 존재하지 않습니다." };
	char * ChangeMsg[] = { "수정성공", "등록된 데이터가 없습니다.", "찾으려는 데이터가 존재하지 않습니다." };
	char * DeleteMsg[] = { "삭제성공", "삭제 등록된 데이터가 없습니다.", "찾으려는 데이터가 존재하지 않습니다." };
	ISBN * BookArray = {};
	char mode = '1';
	int TotalBook=10;
	int	BookNum = 0;
	BookArray = (ISBN *)malloc(sizeof(ISBN)* 1);
	while (mode != '0'){
		printf("\nmode 선택 ( 1 = 입력 , 2 = 출력 , 3 = 단일검색, 4 = 수정(정확한 이름), 5 = 단일삭제(정확한 이름), 6 = 파일저장, 7 = 파일로드 0 = 종료) \n");
		mode = getchar();
		fflush(stdin);

		switch (mode)
		{
		case '1':
			AddBook(BookArray, &BookNum, TotalBook);
			break;
		case '2':
			PrintBookList(BookArray, BookNum);
			break;
		case '3':
			SearchBook(BookArray, BookNum, SearchMsg);
			break;
		case '4':
			ChangeBook(BookArray, BookNum, SearchMsg, ChangeMsg);
			break;
		case '5':
			DeleteBook(BookArray, &BookNum, DeleteMsg);
			break;
		case '6':
			FilePrint(BookArray, TotalBook, BookNum);
			break;
		case '7':
			FileScan(BookArray, &TotalBook, &BookNum);
			break;
		default:
			mode = '0';
			for (int i= 0; i < TotalBook;i++)
			KillData(&BookArray[i]);
			break;
		}
	}
}
コード例 #5
0
ファイル: Books.C プロジェクト: 1040003585/LearnedCandCPP
/*显示主菜单,连接数据库*/
int main()
{
    int n ;   //定义变量  存储用户输入的编号
    
    mysql_init(&mysql);  //初始化mysql结构
    
    showmenu();   /*显示菜单*/ 
    
    scanf("%d",&n);/*输入选择功能的编号*/
    
    while(n)
    { 
        switch(n)
        {
            case 1: 
                ShowAll();    /*调用显示所有图书数据的过程*/
                break;
            case 2: 
                AddBook();   /*添加图书信息*/
                break;
            case 3: 
                ModifyBook();     /*修改图书信息*/
                break;
            case 4:
                DeleteBook();   /*删除图书信息*/
                break;
            case 5:
                QueryBook();   /*查询图书信息*/
                break;
            case 6:
                exit(0);       /*退出*/
            default:break;
        }
        scanf("%d",&n);
    }
}
コード例 #6
0
ファイル: helpdata.cpp プロジェクト: CobaltBlues/wxWidgets
bool wxHtmlHelpData::AddBook(const wxString& book)
{
    wxString extension(book.Right(4).Lower());
    if (extension == wxT(".zip") ||
#if wxUSE_LIBMSPACK
        extension == wxT(".chm") /*compressed html help book*/ ||
#endif
        extension == wxT(".htb") /*html book*/)
    {
        wxFileSystem fsys;
        wxString s;
        bool rt = false;

#if wxUSE_LIBMSPACK
        if (extension == wxT(".chm"))
            s = fsys.FindFirst(book + wxT("#chm:*.hhp"), wxFILE);
        else
#endif
            s = fsys.FindFirst(book + wxT("#zip:*.hhp"), wxFILE);

        while (!s.empty())
        {
            if (AddBook(s)) rt = true;
            s = fsys.FindNext();
        }

        return rt;
    }

    wxFSFile *fi;
    wxFileSystem fsys;

    wxString title = _("noname"),
             safetitle,
             start = wxEmptyString,
             contents = wxEmptyString,
             index = wxEmptyString,
             charset = wxEmptyString;

    fi = fsys.OpenFile(book);
    if (fi == NULL)
    {
        wxLogError(_("Cannot open HTML help book: %s"), book.c_str());
        return false;
    }
    fsys.ChangePathTo(book);

    const wxChar *lineptr;
    wxChar linebuf[300];
    wxString tmp;
    wxHtmlFilterPlainText filter;
    tmp = filter.ReadFile(*fi);
    lineptr = tmp.c_str();

    do
    {
        lineptr = ReadLine(lineptr, linebuf, 300);

        for (wxChar *ch = linebuf; *ch != wxT('\0') && *ch != wxT('='); ch++)
           *ch = (wxChar)wxTolower(*ch);

        if (wxStrstr(linebuf, wxT("title=")) == linebuf)
            title = linebuf + wxStrlen(wxT("title="));
        if (wxStrstr(linebuf, wxT("default topic=")) == linebuf)
            start = linebuf + wxStrlen(wxT("default topic="));
        if (wxStrstr(linebuf, wxT("index file=")) == linebuf)
            index = linebuf + wxStrlen(wxT("index file="));
        if (wxStrstr(linebuf, wxT("contents file=")) == linebuf)
            contents = linebuf + wxStrlen(wxT("contents file="));
        if (wxStrstr(linebuf, wxT("charset=")) == linebuf)
            charset = linebuf + wxStrlen(wxT("charset="));
    } while (lineptr != NULL);

    wxFontEncoding enc = wxFONTENCODING_SYSTEM;
#if wxUSE_FONTMAP
    if (charset != wxEmptyString)
        enc = wxFontMapper::Get()->CharsetToEncoding(charset);
#endif

    // No conversion was done on the title yet; at least
    // test for a common case.
    if (charset == wxT("utf-8") && !title.IsEmpty())
    {
        char *buf = new char[title.Length()+1];
        size_t i;
        for (i = 0; i < title.Length(); i++)
            buf[i] = (char) title[i];
        buf[i] = 0;
        title = wxString::FromUTF8(buf);
        delete[] buf;
    }

    bool rtval = AddBookParam(*fi, enc,
                              title, contents, index, start, fsys.GetPath());
    delete fi;

    return rtval;
}
コード例 #7
0
ファイル: helpctrl.cpp プロジェクト: iokto/newton-dynamics
bool wxHtmlHelpController::AddBook(const wxFileName& book_file, bool show_wait_msg)
{
    return AddBook(wxFileSystem::FileNameToURL(book_file), show_wait_msg);
}