本文整理汇总了C++中Language函数的典型用法代码示例。如果您正苦于以下问题:C++ Language函数的具体用法?C++ Language怎么用?C++ Language使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Language函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: left
DataFrameJoinVisitors::DataFrameJoinVisitors(const Rcpp::DataFrame& left_, const Rcpp::DataFrame& right_, Rcpp::CharacterVector names_left, Rcpp::CharacterVector names_right, bool warn_ ) :
left(left_), right(right_),
visitor_names_left(names_left),
visitor_names_right(names_right),
nvisitors(names_left.size()),
visitors(nvisitors),
warn(warn_)
{
std::string name_left, name_right ;
IntegerVector indices_left = Language( "match", names_left, RCPP_GET_NAMES(left) ).fast_eval() ;
IntegerVector indices_right = Language( "match", names_right, RCPP_GET_NAMES(right) ).fast_eval() ;
for( int i=0; i<nvisitors; i++){
name_left = names_left[i] ;
name_right = names_right[i] ;
if( indices_left[i] == NA_INTEGER ){
stop( "'%s' column not found in lhs, cannot join" ) ;
}
if( indices_right[i] == NA_INTEGER ){
stop( "'%s' column not found in rhs, cannot join" ) ;
}
visitors[i] = join_visitor( left[indices_left[i]-1], right[indices_right[i]-1], name_left, name_right, warn ) ;
}
}
示例2: tr
// This routine called before any translations loaded, so strings must be translated explicitly.
void Settings::makeDefault ()
{
_regionID = "1"; // Default city
_cities["1"] = tr ("Moscow");
_cities["10174"] = tr ("St.Petersburg");
_cities["20544"] = tr ("Kiev");
_cities["11162"] = tr ("Ekaterinburg");
setCheck (C_ShowLight, true);
setCheck (C_ShowRank, true);
setCheck (C_ShowHint, true);
setCheck (C_UpdateOnWiFi, true);
setCheck (C_UpdateWhenLocked, true);
_updateIntervalIndex = 3;
// languages
_langs.append (Language (QString (""), tr ("System")));
_langs.append (Language (QString ("en"), tr ("English")));
_langs.append (Language (QString ("ru"), tr ("Russian")));
setLanguageIndex (0);
}
示例3: MakeNotMember
void Channel::Say(ObjectGuid guid, std::string const& what, uint32 lang)
{
if (what.empty())
return;
// TODO: Add proper RBAC check
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
lang = LANG_UNIVERSAL;
if (!IsOn(guid))
{
WorldPacket data;
MakeNotMember(&data);
SendToOne(&data, guid);
return;
}
if (playersStore[guid].IsMuted())
{
WorldPacket data;
MakeMuted(&data);
SendToOne(&data, guid);
return;
}
WorldPacket data;
if (Player* player = ObjectAccessor::FindPlayer(guid))
ChatHandler::BuildChatPacket(data, CHAT_MSG_CHANNEL, Language(lang), player, player, what, 0, _name);
else
ChatHandler::BuildChatPacket(data, CHAT_MSG_CHANNEL, Language(lang), guid, guid, what, 0, "", "", 0, false, _name);
SendToAll(&data, !playersStore[guid].IsModerator() ? guid : ObjectGuid::Empty);
}
示例4: Language
Language Language::TryParse(const std::wstring& s)
{
if (IsValidCode(s))
return Language(s);
// Is it a standard language code?
if (std::regex_match(s, RE_LANG_CODE_PERMISSIVE))
{
std::wstring s2(s);
TryNormalize(s2);
if (IsValidCode(s2))
return Language(s2);
}
// If not, perhaps it's a human-readable name (perhaps coming from the language control)?
auto names = GetDisplayNamesData();
icu::UnicodeString s_icu = ToIcuStr(s);
s_icu.foldCase();
std::wstring folded = StdFromIcuStr(s_icu);
auto i = names.names.find(folded);
if (i != names.names.end())
return Language(i->second);
// Maybe it was in English?
i = names.namesEng.find(folded);
if (i != names.namesEng.end())
return Language(i->second);
return Language(); // invalid
}
示例5: Choose_Mailbox
void Choose_Mailbox(char *Option)
{
char *temp;
if (HasNoEmail())
return;
if (strlen(Option)) {
if (!strcmp(Option, "M+")) {
if (!strcmp(sMailbox, "mailbox"))
SetEmailArea((char *)"archive");
else if (!strcmp(sMailbox, "archive"))
SetEmailArea((char *)"trash");
else if (!strcmp(sMailbox, "trash"))
SetEmailArea((char *)"mailbox");
}
if (!strcmp(Option, "M-")) {
if (!strcmp(sMailbox, "mailbox"))
SetEmailArea((char *)"trash");
else if (!strcmp(sMailbox, "trash"))
SetEmailArea((char *)"archive");
else if (!strcmp(sMailbox, "archive"));
SetEmailArea((char *)"mailbox");
}
Syslog('+', "Emailarea: %s", sMailbox);
return;
}
clear();
Enter(1);
/* Message areas */
pout(CFG.HiliteF, CFG.HiliteB, (char *) Language(231));
Enter(2);
pout(WHITE, BLACK, (char *)" 1"); pout(LIGHTBLUE, BLACK, (char *)" . "); pout(CYAN, BLACK, (char *) Language(467)); Enter(1);
pout(WHITE, BLACK, (char *)" 2"); pout(LIGHTBLUE, BLACK, (char *)" . "); pout(CYAN, BLACK, (char *) Language(468)); Enter(1);
pout(WHITE, BLACK, (char *)" 3"); pout(LIGHTBLUE, BLACK, (char *)" . "); pout(CYAN, BLACK, (char *) Language(469)); Enter(1);
pout(CFG.MoreF, CFG.MoreB, (char *) Language(470));
colour(CFG.InputColourF, CFG.InputColourB);
temp = calloc(81, sizeof(char));
GetstrC(temp, 7);
switch (atoi(temp)) {
case 1: SetEmailArea((char *)"mailbox");
break;
case 2: SetEmailArea((char *)"archive");
break;
case 3: SetEmailArea((char *)"trash");
break;
}
Syslog('+', "Emailarea: %s", sMailbox);
free(temp);
}
示例6: data
CharacterVectorOrderer::CharacterVectorOrderer( const CharacterVector& data_ ) :
data(data_),
set(),
orders(no_init(data.size()))
{
int n = data.size() ;
if( n == 0 ) return ;
// 1 - gather unique SEXP pointers from data
SEXP* p_data = Rcpp::internal::r_vector_start<STRSXP>(data);
SEXP previous = *p_data++ ;
set.insert( previous ) ;
for( int i=1; i<n; i++, p_data++){
SEXP s = *p_data ;
// we've just seen this string, keep going
if( s == previous ) continue ;
// is this string in the set already
set.insert(s) ;
previous = s ;
}
// retrieve unique strings from the set
int n_uniques = set.size() ;
CharacterVector uniques( set.begin(), set.end() ) ;
CharacterVector s_uniques = Language( "sort", uniques ).fast_eval() ;
// order the uniques with a callback to R
IntegerVector o = Language( "match", uniques, s_uniques ).fast_eval() ;
// combine uniques and o into a hash map for fast retrieval
dplyr_hash_map<SEXP,int> map ;
for( int i=0; i<n_uniques; i++){
map.insert( std::make_pair(uniques[i], o[i] ) ) ;
}
// grab min ranks
p_data = Rcpp::internal::r_vector_start<STRSXP>(data);
previous = *p_data++ ;
int o_pos ;
orders[0] = o_pos = map.find(previous)->second ;
for( int i=1; i<n; i++, p_data++){
SEXP s = *p_data;
if( s == previous ) {
orders[i] = o_pos ;
continue ;
}
previous = s ;
orders[i] = o_pos = map.find(s)->second ;
}
}
示例7: QuickScan_Email
void QuickScan_Email(void)
{
int FoundMsg = FALSE;
int i;
char temp[81];
iLineCount = 2;
WhosDoingWhat(READ_POST, NULL);
if (EmailBase.Total == 0) {
Enter(1);
/* There are no messages in this area. */
pout(WHITE, BLACK, (char *) Language(205));
Enter(2);
sleep(3);
return;
}
clear();
/* # From To Subject */
poutCR(YELLOW, BLUE, (char *) Language(220));
if (Msg_Open(sMailpath)) {
for (i = EmailBase.Lowest; i <= EmailBase.Highest; i++) {
if (Msg_ReadHeader(i)) {
snprintf(temp, 81, "%-6u", Msg.Id);
pout(WHITE, BLACK, temp);
snprintf(temp, 81, "%s ", padleft(Msg.From, 20, ' '));
pout(CYAN, BLACK, temp);
snprintf(temp, 81, "%s ", padleft(Msg.To, 20, ' '));
pout(GREEN, BLACK, temp);
snprintf(temp, 81, "%s", padleft(Msg.Subject, 31, ' '));
pout(MAGENTA, BLACK, temp);
Enter(1);
FoundMsg = TRUE;
if (LC(1))
break;
}
}
Msg_Close();
}
if(!FoundMsg) {
Enter(1);
/* There are no messages in this area. */
pout(LIGHTGREEN, BLACK, (char *) Language(205));
Enter(2);
sleep(3);
}
iLineCount = 2;
Pause();
}
示例8: assert
void
CapabilityContainer::init( vector<Capability*> const & vecCap, TypeSystem const & typeSystem, EnMatchPolicy enMatchPolicy ) {
iv_enMatchPolicy = enMatchPolicy;
vector<Capability*>::const_iterator it;
assert(iv_mapLang2InputTypesOrFeatures.size() == 0);
assert(iv_mapLang2OutputTypesOrFeatures.size() == 0);
for (it = vecCap.begin(); it != vecCap.end(); ++it) {
assert(EXISTS(*it));
Capability const & cap = (*(*it));
initTypeOrFeatures(
iv_mapLang2InputTypesOrFeatures,
cap.getCapabilityTypes(Capability::INPUT),
cap.getSupportedLanguages(),
typeSystem);
initTypeOrFeatures(
iv_mapLang2InputTypesOrFeatures,
cap.getCapabilityFeatures(Capability::INPUT),
cap.getSupportedLanguages(),
typeSystem);
initTypeOrFeatures(
iv_mapLang2OutputTypesOrFeatures,
cap.getCapabilityTypes(Capability::OUTPUT),
cap.getSupportedLanguages(),
typeSystem);
initTypeOrFeatures(
iv_mapLang2OutputTypesOrFeatures,
cap.getCapabilityFeatures(Capability::OUTPUT),
cap.getSupportedLanguages(),
typeSystem);
}
// try to find input tofs for unspecifed language
assert(iv_psetInputTOFsForUnspecifiedLang == NULL);
TySetTypeOrFeatures const * pSetInputTOFs =
findInputTOFs(Language(Language::UNSPECIFIED));
if (pSetInputTOFs != NULL) {
iv_psetInputTOFsForUnspecifiedLang = pSetInputTOFs;
}
// try to find output tofs for unspecifed language
assert(iv_psetOutputTOFsForUnspecifiedLang == NULL);
TySetTypeOrFeatures const * pSetOutputTOFs =
findOutputTOFs(Language(Language::UNSPECIFIED));
if (pSetOutputTOFs != NULL) {
iv_psetOutputTOFsForUnspecifiedLang = pSetOutputTOFs;
}
copyEntriesForUnspecifedLanguage();
if (hasEmptyOutputTypeOrFeatures(Language(Language::UNSPECIFIED))) {
iv_bHasEmptyOutputTOFsForUnspecifiedLang = true;
}
computeClosure(iv_mapLang2OutputTypesOrFeatures, iv_mapLang2OutputTypesOrFeaturesNoTerritory );
computeClosure(iv_mapLang2InputTypesOrFeatures, iv_mapLang2InputTypesOrFeaturesNoTerritory );
}
示例9: MakeNotMember
void Channel::Say(uint64 guid, std::string const& what, uint32 lang)
{
if (what.empty())
return;
if (!IsOn(guid))
{
WorldPacket data;
MakeNotMember(&data);
SendToOne(&data, guid);
return;
}
PlayerInfo& pinfo = playersStore[guid];
if (pinfo.IsMuted())
{
WorldPacket data;
MakeMuted(&data);
SendToOne(&data, guid);
return;
}
Player* player = pinfo.plrPtr;
if (player && !player->GetSession()->GetSecurity()) // pussywizard: prevent spam on populated channels
{
uint32 speakDelay = 0;
if (_channelRights.speakDelay > 0)
speakDelay = _channelRights.speakDelay;
else if (playersStore.size() >= 10)
speakDelay = 5;
if (!pinfo.IsAllowedToSpeak(speakDelay))
{
std::string timeStr = secsToTimeString(pinfo.lastSpeakTime + speakDelay - sWorld->GetGameTime());
if (_channelRights.speakMessage.length() > 0)
player->GetSession()->SendNotification(_channelRights.speakMessage.c_str());
player->GetSession()->SendNotification("You must wait %s before speaking again.", timeStr.c_str());
return;
}
}
WorldPacket data;
if (player)
ChatHandler::BuildChatPacket(data, CHAT_MSG_CHANNEL, Language(lang), player, player, what, 0, _name);
else
ChatHandler::BuildChatPacket(data, CHAT_MSG_CHANNEL, Language(lang), guid, guid, what, 0, "", "", 0, false, _name);
SendToAll(&data, pinfo.IsModerator() ? 0 : guid);
}
示例10: Language
Language LanguageListModel::get(int index) const
{
if (index < 0 || index >= m_languages.count())
return Language();
return m_languages.at(index);
}
示例11: operator
WorldPackets::Chat::Chat* operator()(LocaleConstant locale) const
{
std::string const& text = sCreatureTextMgr->GetLocalizedChatString(_source->GetEntry(), _gender, _textGroup, _textId, locale);
WorldPackets::Chat::Chat* chat = new WorldPackets::Chat::Chat();
chat->Initialize(_msgType, Language(_language), _talker, _target, text, 0, "", locale);
return chat;
}
示例12: check_attribute_compatibility
void check_attribute_compatibility(SEXP left, SEXP right) {
SEXP att_left = ATTRIB(left);
SEXP att_right = ATTRIB(right);
int n_left = count_attributes(att_left);
int n_right = count_attributes(att_right);
if (Rf_inherits(left, "POSIXct") && Rf_inherits(right, "POSIXct")) {
return;
}
if (n_left != n_right)
stop("attributes of different sizes");
List list_left(n_left), list_right(n_left);
SEXP p_left = att_left;
int i = 0;
while (!Rf_isNull(p_left)) {
SEXP name = TAG(p_left);
if (name != R_NamesSymbol && name != R_DimSymbol) {
list_left[i] = CAR(p_left);
list_right[i] = grab_attribute(name, att_right);
}
p_left = CDR(p_left);
}
RObject test = Language("all.equal", list_left, list_right).fast_eval();
if (!is<bool>(test) || !as<bool>(test)) {
stop("attributes are different");
}
}
示例13: SetupEPGDumpLanguage
void SetupEPGDumpLanguage( void* Handle, unsigned long lLanguageCode )
{
REMUXER *pRemuxer = (REMUXER *)Handle;
if ( pRemuxer->demuxer->ts_parser )
SetupTSEPGDumpLanguage( pRemuxer->demuxer->ts_parser, lLanguageCode );
SageLog(( _LOG_ERROR, 3, TEXT("Set default EPG language \"%s\"."), Language(lLanguageCode, NULL ) ));
}
示例14: window
Main::Main(sf::RenderWindow & window) : window(window)
{
playingGame = true;
/*
Create the language variable (default: American English)
*/
l = Language("en-US");
/*
Load options from Options.txt
Current things the program is looking for:
openFile;
language = [ja-JP]
*/
KFile options(sf::String(RESOURCES + "Options.txt"));
wstring w;
options.readLine(w);
l = Language(StringEditor::substring(w, StringEditor::findCharacter(w, L'=', 1) + 1, w.length()));
/*
Instantiate the font based off of the game language
English users don't need the Japanese character set loaded (saves space)
*/
font = KText(l);
/*
Sets the game state; the final version of the game should have this set to logo screen,
then goes to the main menu
*/
gs = GameState::MAIN_MENU;
/*
Loads the game modes.
Only one variable should be loaded at one point, so we need to figure out how to unload modes
when you aren't using them. Ie, single player and multiplayer shouldn't be loaded on the stack
(I don't think I am using that term correctly)
*/
mainMenu = MainMenu(l);
/*
Create a black background
*/
bg.setSize(sf::Vector2f((float)INT_MAX, (float)INT_MAX));
bg.setFillColor(sf::Color::Black);
bg.setPosition(sf::Vector2f((float)(INT_MIN / 2), (float)(INT_MIN / 2)));
}
示例15: builder
void Channel::Say(ObjectGuid const& guid, std::string const& what, uint32 lang) const
{
if (what.empty())
return;
// TODO: Add proper RBAC check
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
lang = LANG_UNIVERSAL;
if (!IsOn(guid))
{
NotMemberAppend appender;
ChannelNameBuilder<NotMemberAppend> builder(this, appender);
SendToOne(builder, guid);
return;
}
PlayerInfo const& playerInfo = _playersStore.at(guid);
if (playerInfo.IsMuted())
{
MutedAppend appender;
ChannelNameBuilder<MutedAppend> builder(this, appender);
SendToOne(builder, guid);
return;
}
auto builder = [&](LocaleConstant locale)
{
LocaleConstant localeIdx = sWorld->GetAvailableDbcLocale(locale);
WorldPackets::Chat::Chat* packet = new WorldPackets::Chat::Chat();
if (Player* player = ObjectAccessor::FindConnectedPlayer(guid))
packet->Initialize(CHAT_MSG_CHANNEL, Language(lang), player, player, what, 0, GetName(localeIdx));
else
{
packet->Initialize(CHAT_MSG_CHANNEL, Language(lang), nullptr, nullptr, what, 0, GetName(localeIdx));
packet->SenderGUID = guid;
packet->TargetGUID = guid;
}
return packet;
};
SendToAll(builder, !playerInfo.IsModerator() ? guid : ObjectGuid::Empty);
}