int main( const int argc , const char ** argv ) {
    if( flagSpecified(argc,argv,kFlagLogo) )
        displayLogo();
    initializeRandomGenerator();
    initializeSsl();
    // Not the most beautiful piece of initialization code :)
    if( controllerRequested(argc,argv) )
        startController(argc,argv);
    else
    if( serverRequested(argc,argv) )
        startServer(argc,argv);
    else
    if( clientRequested(argc,argv) )
        startClient(argc,argv);
    else
    if( eventStreamRequested(argc,argv) )
        startEventStream(argc,argv);
    else
    if( generateHashRequested(argc,argv) )
        startGenerateHash(argc,argv);
    else
    if( addControllerRequested(argc,argv) )
        startAddController(argc,argv);
    else
        usage();
    cleanupSsl();
    cleanupLogger();

    return EXIT_SUCCESS;
}
예제 #2
0
void addUser(LinkedList<User> *listOfUsers)
{
	string name, username, password;

	clearScreen();
	displayLogo();

	//The user is prompted for the appropriate information
	cout << "Please enter the name of the new user:\n\n";
	getline(cin, name);

	cout << "\nPlease enter the username of the new user:\n\n";
	getline(cin, username);

	cout << "\nPlease enter the password of the new user:\n\n";
	getline(cin, password);

	//A new user with the specified information is created
	User newUser(name, username, password);

	//The new user is added to the list of users
	listOfUsers->append(newUser);
	
	saveUsers(listOfUsers);
}
예제 #3
0
void displaySearchMenu(LinkedList<Item> *listOfItems, LinkedList<Club> *listOfClubs, LinkedList<User> *listOfUsers)
{
	int choice = 0;

	clearScreen();
	displayLogo();

	cout << setw(22) << right << "Search Menu:\n\n\n";
	cout << setw(12) << right << "1.) " << left << "Search for a Club\n";
	cout << setw(12) << right << "2.) " << left << "Search for an Item\n";
	cout << setw(12) << right << "3.) " << left << "Return to Menu\n";
	
	string junk;
	do {
		cout << setw(28) << right << "Please enter a choice: ";
		cin >> choice;
		getline(cin, junk); // get rid of anything else in the line
		if (choice < 1 || choice > 3)
			cout << setw(28) << right << "Invalid...\n";
	} while (choice < 1 || choice > 3);

	switch (choice)
	{
	case 1:
		searchClub(listOfItems);
		break;
	case 2:
		searchItem(listOfItems);
		break;
	case 3:
		displayGeneralMenu(listOfItems, listOfClubs, listOfUsers);
	}
}
예제 #4
0
void addItem(LinkedList<Item> *listOfItems)
{
	clearScreen();
	displayLogo();

	Item item;
	Location location;
	Source source;
	Seller seller;
	Address sellerAddress;
	int serialNumber;
	double price;
	string name, type, club = "SGA", sellerName, building, room, shelfSlot, sellerURL, junk;
	bool status = true;

	cout << "Enter the serial number of the new item: ";
	cin >> serialNumber;
	getline(cin, junk);
	cout << "What is the name of the item you wish to add? ";
	getline(cin, name);
	cout << "What is the type of the item you wish to add? ";
	getline(cin, type);
	cout << "Where was the item bought? ";
	getline(cin, sellerName);
	cout << "What is the URL of the store? ";
	getline(cin, sellerURL);
	cout << "What is the price of the item you wish to add? ";
	cin >> price;
	getline(cin, junk);
	cout << "What building is the item being stored in? ";
	getline(cin, building);
	cout << "What room is the item being stored in? ";
	getline(cin, room);
	cout << "What shelf slot is the item being stored in? ";
	getline(cin, shelfSlot);

	location.setBuilding(building);
	location.setRoom(room);
	location.setCode(shelfSlot);  // Sets the information for location

	seller.setName(sellerName);
	seller.setAddress(sellerAddress);
	seller.setURL(sellerURL);     // Sets the information for seller

	source.setSeller(seller);
	source.setUnitPrice(price);   // Sets the information for Source

	item.setSerial(serialNumber);
	item.setName(name);
	item.setNameType(type);
	item.setLocation(location);
	item.setSource(source);
	item.setStatus(status);    //Sets all the Data for tmp

	listOfItems->append(item);  //Adds new item to the end of the list

	saveItems(listOfItems);
	//itemsOutput(serialNumber, name, type, club, sellerName, price, building, room, shelfSlot, status);  // File Output
}
예제 #5
0
void displayAdminItem(LinkedList<Item> *listOfItems, LinkedList<Club> *listOfClubs, LinkedList<User> *listOfUsers)
{
	int choice = 0;
	string junk;

	clearScreen();
	displayLogo();

	cout << setw(36) << right << "Administrator Item Menu:\n\n\n";
	cout << setw(12) << right << "1.) " << left << "Show In Items\n";
	cout << setw(12) << right << "2.) " << left << "Show Out Items\n";
	cout << setw(12) << right << "3.) " << left << "Show All Items\n";
	cout << setw(12) << right << "4.) " << left << "Add Item\n";
	cout << setw(12) << right << "5.) " << left << "Remove Item\n";
	cout << setw(12) << right << "6.) " << left << "Modify Item\n";
	cout << setw(12) << right << "7.) " << left << "Return to Administrator Menu\n";

	cout << setw(28) << right << "Please enter a choice: ";
	cin >> choice;
	getline(cin, junk);

	while ((choice < 1) || (choice > 7))
	{
		cout << setw(28) << right << "Invalid... Enter choice: ";
		cin >> choice;
		getline(cin, junk);
	}

	switch (choice)
	{
	case 1:
		showInItems(listOfItems);
		break;
	case 2:
		showOutItems(listOfItems);
		break;
	case 3:
		showAllItems(listOfItems);
		break;
	case 4:
		addItem(listOfItems);
		break;
	case 5:
		removeItem(listOfItems);
		break;
	case 6: 
		modifyItem(listOfItems);
		break;
	case 7:
		displayAdminMenu(listOfItems, listOfClubs, listOfUsers);
		return;
	}
	pause();
}
예제 #6
0
파일: nomis.cpp 프로젝트: ccaroon/arduino
bool Nomis::menu() {
    Button b = Button::NONE;
    displayLogo();

    arduboy.setCursor(15, 35);
    arduboy.setTextSize(1);
    arduboy.print("Press A to Start");
    arduboy.display();

    while (b != Button::A) {
        b = checkForButtonPress();
    }

    return true;
}
예제 #7
0
int main() {
    init(&width, &height);                  // Graphics initialization
    
    while(1)
    {
        if ( system("ping -c 1 -W 3 10.155.0.1 > /dev/null") == 0)
        {
            displayLogo();
        }
        else
        {
            displayLogoConnecting();
        }
        sleep(1);
    }
    
    finish();                               // Graphics cleanup
    exit(0);
}
예제 #8
0
void displayAdminClub(LinkedList<Item> *listOfItems, LinkedList<Club> *listOfClubs, LinkedList<User> *listOfUsers)
{
	int choice = 0;
	string junk;

	clearScreen();
	displayLogo();

	cout << setw(36) << right << "Administrator Club Menu:\n\n\n";
	cout << setw(12) << right << "1.) " << left << "Add Club\n";
	cout << setw(12) << right << "2.) " << left << "Remove Club\n";
	cout << setw(12) << right << "3.) " << left << "Modify Club\n";
	cout << setw(12) << right << "4.) " << left << "Return to Administrator Menu\n";

	cout << setw(28) << right << "Please enter a choice: ";
	cin >> choice;
	getline(cin, junk);

	while ((choice < 1) || (choice > 4))
	{
		cout << setw(28) << right << "Invalid... Enter choice: ";
		cin >> choice;
		getline(cin, junk);
	}

	switch (choice)
	{
	case 1:
		addClub(listOfClubs);
		break;
	case 2:
		removeClub(listOfClubs);
		break;
	case 3:
		modifyClub(listOfClubs);
		break;
	case 4:
		displayAdminMenu(listOfItems, listOfClubs, listOfUsers);
		return;
	}
	pause();
}
예제 #9
0
//
// Retourne une fenêtre générique avec le logo du jeu.
//
WINDOW* getMenuWindow(int contentHeight, char title[]) {
    if(contentHeight < 0) return NULL;
    
    //hauteur = nombre de choix possibles + 15 (pour le logo)
    int winHeight = contentHeight + WIN_LOGO_TOP_MARGIN + 4;
    int winWidth = POPUP_WINDOW_WIDTH + 10;
    
    //on centre le menu
    int starty = (LINES - winHeight) / 2;
	int startx = (COLS - winWidth) / 2;
    
    WINDOW *win = newwin(winHeight, winWidth, starty, startx);
    
	//on affiche une bordure autour de la fenêtre
    box(win, 0, 0);
    
    //on affiche le logo du jeu
	displayLogo(win, winWidth);
    
    //et deux lignes horizontales
    mvwaddch(win, 11, 0, ACS_LTEE);
    mvwhline(win, 11, 1, ACS_HLINE, winWidth - 1);
    mvwaddch(win, 11, winWidth - 1, ACS_RTEE);
    
    wattron(win, A_UNDERLINE);
    //on affiche un titre
    displayInCenter(win, 12, 0, winWidth, title);
    wattroff(win, A_UNDERLINE);
    
    mvwaddch(win, 13, 0, ACS_LTEE);
    mvwhline(win, 13, 1, ACS_HLINE, winWidth - 1);
    mvwaddch(win, 13, winWidth - 1, ACS_RTEE);
    
    mvprintw(LINES - 1, COLS - COPYRIGHT_SIZE, COPYRIGHT);
    
    return win;
}
예제 #10
0
void displayAdminSearch(LinkedList<Item> *listOfItems, LinkedList<Club> *listOfClubs, LinkedList<User> *listOfUsers)
{
	int choice = 0;
	string junk;

	clearScreen();
	displayLogo();

	cout << setw(22) << right << "Search Menu:\n\n\n";
	cout << setw(12) << right << "1.) " << left << "Search for a Club\n";
	cout << setw(12) << right << "2.) " << left << "Search for an Item\n";
	cout << setw(12) << right << "3.) " << left << "Return to Administrator Menu\n";

	cout << setw(28) << right << "Please enter a choice: ";
	cin >> choice;
	getline(cin, junk);

	while ((choice < 1) || (choice > 3))
	{
		cout << setw(28) << right << "Invalid... Enter choice: ";
		cin >> choice;
		getline(cin, junk);
	}

	switch (choice)
	{
	case 1:
		searchClub(listOfItems);
		break;
	case 2:
		searchItem(listOfItems);
		break;
	case 3:
		displayAdminMenu(listOfItems, listOfClubs, listOfUsers);
	}
}
예제 #11
0
void displayItemMenu(LinkedList<Item> *listOfItems, LinkedList<Club> *listOfClubs, LinkedList<User> *listOfUsers)
{
	int choice = 0;

	clearScreen();
	displayLogo();

	cout << setw(22) << right << "Item Menu:\n\n\n";
	cout << setw(12) << right << "1.) " << left << "Show In Items\n";
	cout << setw(12) << right << "2.) " << left << "Show Out Items\n";
	cout << setw(12) << right << "3.) " << left << "Return to Menu\n";

	string junk;
	
	do {
		cout << setw(28) << right << "Please enter a choice: ";
		cin >> choice;
		getline(cin, junk);
		if (choice < 1 || choice > 3)
			cout << setw(28) << right << "Invalid...\n";
	} while(choice < 1 || choice > 3);

	switch (choice)
	{
	case 1:
		showInItems(listOfItems);
		break;
	case 2:
		showOutItems(listOfItems);
		break;
	case 3:
		displayGeneralMenu(listOfItems, listOfClubs, listOfUsers);
		return;
	}
	pause();
}
예제 #12
0
int main(void)
{
	time_t start, end;

    string dir = string("./moviesdb");	// Stores the path of the folder with the files
    
    multimap<int, string> results; // Stores the qualifying files and sorts them
    
    std::tr1::unordered_set<string> stops; // Stores the stop words
    
    std::tr1::unordered_map< string, std::tr1::unordered_map<std::string,int> > files_freq; // Stores the words, files and frequency
    
	vector<string> inputs; // Stores the inputs of the user
	
    vector<ParsedFile> files; // Stores the files of the directory
    
    char searching[256];
    
    int count = 0;
    
    cout << endl << " Building the Search Engine... "<< endl ;
    time (&start);
  	
  	// Starts the engine 
  	setEngine(dir, stops, files, files_freq);
  	
  	time (&end);
    cout << " The search engine finished building. It took: " << difftime(end,start) << " seconds" << endl << endl;
  	
  	do{
  	
  		
  		// Displays the logo
  		displayLogo();
  		
    	// Gets the inputs of the user
    	getWords(inputs, count);
    	
    	//for (int i = 0; i < inputs.size(); i++)
    	//	cout << inputs[i] << " ";
		
		// Gets results of case with two words
		if(inputs.size() == 2){ 
			results = getResults(inputs[0], inputs[1], files_freq);
		}
	
		// Gets results of case with one word
		else if (inputs.size() == 1){
			results = getResults(inputs[0], inputs[0], files_freq);
		}
	
		//Display the three most highest files based on frequency
		displayResults(results);
		
		cout << "Want to keep searching? Enter 'y' if yes or 'n' if no" << endl;
		cin >> searching;
		
		results.clear();
		
		count++;
		
	}while(strcmp(searching, "y") == 0 || strcmp(searching, "Y") == 0);
	
    return 0;
}