OSArgument makeChoiceArgumentOfWorkspaceObjects(const std::string& name, const std::string& referenceName, const Workspace& workspace, bool required) { std::vector< std::pair<std::string, std::string> > intermediate; std::vector<WorkspaceObject> objects = workspace.getObjectsByReference(referenceName); for (const WorkspaceObject& object : objects){ intermediate.push_back(std::pair<std::string,std::string>(toString(object.handle()), object.name().get())); } std::sort(intermediate.begin(), intermediate.end(), SecondOfPairLess< std::pair<std::string,std::string> >()); int n = intermediate.size(); StringVector choices(n), displayNames(n); for (int i = 0; i < n; ++i) { choices[i] = intermediate[i].first; displayNames[i] = intermediate[i].second; } return OSArgument::makeChoiceArgument(name, choices, displayNames, required); }
/* Function: GetNativeCalendarName Gets the native calendar name. */ CalendarDataResult GetNativeCalendarName(Locale& locale, CalendarId calendarId, UChar* nativeName, int32_t stringCapacity) { LocalPointer<LocaleDisplayNames> displayNames(LocaleDisplayNames::createInstance(locale)); UnicodeString calendarName; displayNames->keyValueDisplayName("calendar", GetCalendarName(calendarId), calendarName); UErrorCode err = U_ZERO_ERROR; calendarName.extract(nativeName, stringCapacity, err); return GetCalendarDataResult(err); }
void EncoderPage::display() { if (redisplay) { displayNames(); } GUI.setLine(GUI.LINE2); for (uint8_t i = 0; i < 4; i++) { if (encoders[i] != NULL) if (encoders[i]->hasChanged() || redisplay || encoders[i]->redisplay) { encoders[i]->displayAt(i); } } }
void BepdfApplication::Initialize() { if (!mInitialized) { mInitialized = true; // built in fonts BPath fontDirectory(mAppPath); fontDirectory.Append("fonts"); // built in encodings BPath encodingDirectory(mAppPath); encodingDirectory.Append("encodings"); InitXpdf(NULL, fontDirectory.Path(), encodingDirectory.Path()); // system fonts BPath systemFontsPath; if (find_directory(B_BEOS_FONTS_DIRECTORY, &systemFontsPath) == B_OK) { BDirectory directory(systemFontsPath.Path()); BEntry entry; while (directory.GetNextEntry(&entry) == B_OK) { if (!entry.IsDirectory()) continue; BPath fontDirectory; if (entry.GetPath(&fontDirectory) != B_OK) continue; setGlobalParameter("fontDir", fontDirectory.Path()); } } // CID fonts BMessage msg; mSettings->GetDisplayCIDFonts(msg); DisplayCIDFonts displayNames(msg); // record new names bool foundNewName = false; GList* list = getCIDToUnicodeNames(globalParams); for (int i = 0; i < list->getLength(); i ++) { GString* name = (GString*)list->get(i); if (displayNames.Contains(name->getCString())) { continue; } // record name displayNames.Set(name->getCString()); foundNewName = true; } // store in settings if (foundNewName) { msg.MakeEmpty(); displayNames.Archive(msg); mSettings->SetDisplayCIDFonts(msg); } // set CID fonts for (int i = 0; i < list->getLength(); i ++) { GString* name = (GString*)list->get(i); BString file; DisplayCIDFonts::Type type; displayNames.Get(name->getCString(), file, type); if (type == DisplayCIDFonts::kUnknownType || file.Length() == 0) { continue; } if (type == DisplayCIDFonts::kTrueType) { setGlobalParameter("displayCIDFontTT", name->getCString(), file.String()); } else { setGlobalParameter("displayCIDFontT1", name->getCString(), file.String()); } } deleteGList(list, GString); } }
/************************************************************************************ * Method header: * Function name: main * Function purpose: This is the main function for the program. * Function parameters: * int argc - This is a count of the number of command line parameters * passed by the operating system. * char *vp[] - This is the array of strings which is passed to program. * Function return value: int. 0 will be returned upon normal exiting of the program. * A negative value will indicate an error. ************************************************************************************/ int main(int argc, char* argv[]) { int rc1; int rc2; int rc3; int rc4; int index; pthread_t threads[THREAD_COUNT]; // Initialize all of the variables. // Global data - for inter-thread communication quit = false; pauseGame = false; ballMovementDelay = INITIAL_BALL_MOVEMENT_DELAY; //set up mutex for locking if (pthread_mutex_init(&mutex, NULL) != 0) { printf("\n mutex init failed\n"); return 1; } // init window - see curses documentation for guidance win = initscr(); (void) cbreak(); (void) noecho(); (void) curs_set(0); (void) keypad(win, TRUE); (void) nodelay(win, TRUE); (void) refresh(); #ifdef SPLASH pthread_t splashThread; if ((rc1 = pthread_create(&splashThread, NULL, &splashscreen, NULL))) { (void) fprintf(stderr, "Splash screen thread creation failed."); } (void) pthread_join(splashThread, NULL); #endif if (argc >= 2 && argv[1] != NULL) { displayNames(argv[1], argv[2]); } // Start the threads if ((rc1 = pthread_create(&threads[0], NULL, &moveball, NULL))) { (void) fprintf(stderr, "Ball movement thread creation failed."); } if ((rc2 = pthread_create(&threads[1], NULL, &moveme, NULL))) { (void) fprintf(stderr, "Player thread creation failed"); } if ((rc3 = pthread_create(&threads[2], NULL, &timer, NULL))) { (void) fprintf(stderr, "Timer thread creation failed"); } if ((rc4 = pthread_create(&threads[3], NULL, &moveopponent, NULL))) { (void) fprintf(stderr, "Move opponent thread creation failed"); } // Wait for the threads to exit for (index = 0; index < THREAD_COUNT; index++) { (void) pthread_join(threads[index], NULL); } // tear down the window (void) delwin(win); (void) endwin(); (void) refresh(); pthread_mutex_destroy(&mutex); // get out of here return 0; }