int main( int argc, char ** argv ) { cgiScript script( "text/html", false ); users_Form myFrm(script); users_List mylist(script); // so you can set cookies if( oLogin.testLoginStatus() ) { script.closeHeader(); cgiTemplates pgTemplate; pgTemplate.load("Templates/adminPane.htmp"); script << ocString(pgTemplate.getParagraph("top")) .replaceAll("$heading$","USERS"); myFrm.loadControlTemplates("Templates/form.htmp"); myFrm.form_action(); myFrm.form_display(); mylist.loadListTemplates("Templates/list.htmp"); mylist.list_display(); script << pgTemplate.getParagraph("bottom"); } else { script.Redirect("signIn.html"); } }
int main( int argc, char ** argv ) { cgiScript script( "text/html", false ); Store_Form stor(script); Store_List mylist(script); // so you can set cookies if( oLogin.testLoginStatus() ) { script.closeHeader(); cgiTemplates pgTemplate; pgTemplate.load("Templates/adminPane.htmp"); script << pgTemplate.getParagraph("top"); stor.loadControlTemplates("Templates/form.htmp"); stor.form_action(); stor.form_display(); mylist.loadListTemplates("Templates/list.htmp"); mylist.list_display(); script << pgTemplate.getParagraph("bottom"); } else { script.Redirect("signIn.html"); } };
int main( int argc, char ** argv ) { cgiScript sc("text/html", false); if( oLogin.testLoginStatus() ) { // Category = everything Category_List mylist(sc); cgiTemplates pgTemplate; pgTemplate.load("Templates/adminPane.htmp"); sc << ocString(pgTemplate.getParagraph("top")) .replaceAll("$heading$","Category & Sub-Category Lists") .replace("$menu$",getNavMenu().c_str()) .replace("$instructions$", "Please add and/or edit all product categories and " "sub-categories from here."); sc << "<div style='float: left;'>" "<iframe src='category_form.cgi' width='550px' height='300px' frameborder='0' name='editPane'>" "</iframe></div><div style='float: left; width: 250px;'>"; mylist.loadListTemplates("Templates/list.htmp"); mylist.list_display(); sc << "</div>" << endl; sc << pgTemplate.getParagraph("list-bottom"); // sc << pgTemplate.getParagraph("bottom"); } else { showSignOnForm (sc); } };
int main () { std::list<int> mylist (2,100); // two ints with a value of 100 mylist.push_front (200); mylist.push_front (300); std::cout << "mylist contains:"; for (std::list<int>::iterator it=mylist.begin(); it!=mylist.end(); ++it) std::cout << ' ' << *it; std::cout << '\n'; return 0; }
std::string bearlib::DiskAvailable(int Encounter) { Sleep(100); char szDriverBuffer[512]; std::string csDriver; GetLogicalDriveStringsA(IN 512, OUT szDriverBuffer); char *lpDriverBuffer = szDriverBuffer; std::string Diskstr[64] = {"C:\\","D:\\","E:\\","F:\\","G:\\","H:\\","I:\\","J:\\","K:\\","L:\\","M:\\","N:\\","O:\\","P:\\","Q:\\","R:\\","S:\\","T:\\","U:\\","V:\\","W:\\","X:\\","Y:\\","Z:\\"}; std::string The_goal; ///////////////// std::list<std::string> mylist (Diskstr,Diskstr+24); ///////////////////////////// while (*lpDriverBuffer != NULL) { csDriver = lpDriverBuffer; lpDriverBuffer = lpDriverBuffer + csDriver.length() + 1; for(int i=0;i<64;i++) { if(csDriver == Diskstr[i]) { //std::cout<<Diskstr[i].c_str()<<std::endl; mylist.remove(Diskstr[i].c_str()); } } } for (std::list<std::string>::iterator it=mylist.begin(); it!=mylist.end(); ++it) { The_goal = *it; } if(Encounter == 0) { mylist.remove(The_goal); for (std::list<std::string>::iterator it=mylist.begin(); it!=mylist.end(); ++it) { The_goal = *it; } } return The_goal.substr(0,The_goal.size()-1).c_str(); }
//test stateful allocation bool test_allocator() { { Test_Allocator alloc; gtl::Context context(&alloc); try { construct_throw* pTest = new(&context) construct_throw(); context.destroy(pTest); } catch(...) { } GTL_ASSERT(alloc.m_alloc == 1); GTL_ASSERT(alloc.m_dealloc == 1); } //test stl allocator { Test_Allocator alloc; typedef std::list<int, gtl::STL_Allocator<int> > list; list mylist(alloc); mylist.push_back(5); mylist.push_back(5); GTL_ASSERT(alloc.m_alloc > 0); } { Test_Allocator alloc; typedef std::vector<int, gtl::STL_Allocator<int> > vector; vector vec(alloc); vec.push_back(5); vec.push_back(5); GTL_ASSERT(alloc.m_alloc > 0); } return true; }
bool test_list() { typedef std::vector<legacy_value> Vect; //Create legacy_value objects, with a different internal number Vect legacy_vector; for(int i = 0; i < 100; ++i){ legacy_value value; value.id_ = i; legacy_vector.push_back(value); } //Create the list with the objects List mylist(legacy_vector.begin(), legacy_vector.end()); //Now test both lists typename List::const_iterator bit(mylist.begin()), bitend(mylist.end()); typename Vect::const_iterator it(legacy_vector.begin()), itend(legacy_vector.end()); //Test the objects inserted in our list for(; it != itend; ++it, ++bit) if(&*bit != &*it) return false; return true; }