![]() |
TrinityCore
|
#include "Define.h"#include "Errors.h"#include "Optional.h"#include <array>#include <string>#include <string_view>#include <sstream>#include <typeinfo>#include <utility>#include <vector>
Include dependency graph for Util.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Classes | |
| struct | WcharToUpper |
| struct | WcharToUpperOnlyLatin |
| struct | WcharToLower |
| struct | CharToUpper |
| struct | CharToLower |
| struct | StringCompareLessI_T |
| class | HookList< T > |
| class | flag96 |
Namespaces | |
| namespace | Trinity |
| namespace | Trinity::Impl |
Enumerations | |
| enum class | TimeFormat : uint8 { FullText , ShortText , Numeric } |
| enum | ComparisionType { COMP_TYPE_EQ = 0 , COMP_TYPE_HIGH , COMP_TYPE_LOW , COMP_TYPE_HIGH_EQ , COMP_TYPE_LOW_EQ , COMP_TYPE_MAX } |
Functions | |
| TC_COMMON_API void | Trinity::VerifyOsVersion () |
| TC_COMMON_API std::vector< std::string_view > | Trinity::Tokenize (std::string_view str, char sep, bool keepEmpty) |
| std::vector< std::string_view > | Trinity::Tokenize (std::string &&, char, bool)=delete |
| std::vector< std::string_view > | Trinity::Tokenize (std::string const &&, char, bool)=delete |
| std::vector< std::string_view > | Trinity::Tokenize (char const *str, char sep, bool keepEmpty) |
| TC_COMMON_API Optional< int32 > | MoneyStringToMoney (std::string const &moneyString) |
| TC_COMMON_API time_t | GetLocalHourTimestamp (time_t time, uint8 hour, bool onlyAfterTime=true) |
| TC_COMMON_API tm | TimeBreakdown (time_t t) |
| TC_COMMON_API std::string | secsToTimeString (uint64 timeInSecs, TimeFormat timeFormat=TimeFormat::FullText, bool hoursOnly=false) |
| TC_COMMON_API uint32 | TimeStringToSecs (std::string const ×tring) |
| TC_COMMON_API std::string | TimeToTimestampStr (time_t t) |
| TC_COMMON_API std::string | TimeToHumanReadable (time_t t) |
| template<class T , class U > | |
| T | CalculatePct (T base, U pct) |
| template<class T , class U > | |
| T | AddPct (T &base, U pct) |
| template<class T , class U > | |
| T | ApplyPct (T &base, U pct) |
| template<class T > | |
| T | RoundToInterval (T &num, T floor, T ceil) |
| template<class T > | |
| T | square (T x) |
| TC_COMMON_API bool | Utf8toWStr (std::string_view utf8str, std::wstring &wstr) |
| TC_COMMON_API bool | Utf8toWStr (char const *utf8str, size_t csize, wchar_t *wstr, size_t &wsize) |
| bool | Utf8toWStr (std::string_view utf8str, wchar_t *wstr, size_t &wsize) |
| TC_COMMON_API bool | WStrToUtf8 (std::wstring_view wstr, std::string &utf8str) |
| TC_COMMON_API bool | WStrToUtf8 (wchar_t const *wstr, size_t size, std::string &utf8str) |
| TC_COMMON_API size_t | utf8length (std::string &utf8str) |
| TC_COMMON_API void | utf8truncate (std::string &utf8str, size_t len) |
| bool | isBasicLatinCharacter (wchar_t wchar) |
| bool | isExtendedLatinCharacter (wchar_t wchar) |
| bool | isCyrillicCharacter (wchar_t wchar) |
| bool | isEastAsianCharacter (wchar_t wchar) |
| bool | isNumeric (wchar_t wchar) |
| bool | isNumeric (char c) |
| bool | isNumeric (char const *str) |
| bool | isNumericOrSpace (wchar_t wchar) |
| bool | isBasicLatinString (std::wstring_view wstr, bool numericOrSpace) |
| bool | isExtendedLatinString (std::wstring_view wstr, bool numericOrSpace) |
| bool | isCyrillicString (std::wstring_view wstr, bool numericOrSpace) |
| bool | isEastAsianString (std::wstring_view wstr, bool numericOrSpace) |
| TC_COMMON_API void | wstrToUpper (std::wstring &str) |
| TC_COMMON_API void | wstrToLower (std::wstring &str) |
| TC_COMMON_API void | strToUpper (std::string &str) |
| TC_COMMON_API void | strToLower (std::string &str) |
| TC_COMMON_API std::wstring | GetMainPartOfName (std::wstring const &wname, uint32 declension) |
| TC_COMMON_API bool | utf8ToConsole (std::string_view utf8str, std::string &conStr) |
| TC_COMMON_API bool | consoleToUtf8 (std::string_view conStr, std::string &utf8str) |
| TC_COMMON_API bool | Utf8FitTo (std::string_view str, std::wstring_view search) |
| TC_COMMON_API void | utf8printf (FILE *out, const char *str,...) |
| TC_COMMON_API void | vutf8printf (FILE *out, const char *str, va_list *ap) |
| TC_COMMON_API bool | Utf8ToUpperOnlyLatin (std::string &utf8String) |
| TC_COMMON_API bool | ReadWinConsole (std::string &str, size_t size=256) |
| TC_COMMON_API bool | WriteWinConsole (std::string_view str, bool error=false) |
| TC_COMMON_API Optional< std::size_t > | RemoveCRLF (std::string &str) |
| TC_COMMON_API bool | IsIPAddress (char const *ipaddress) |
| Check if the string is a valid ip address representation. | |
| TC_COMMON_API uint32 | CreatePIDFile (std::string const &filename) |
| create PID file | |
| TC_COMMON_API uint32 | GetPID () |
| TC_COMMON_API std::string | Trinity::Impl::ByteArrayToHexStr (uint8 const *bytes, size_t length, bool reverse=false) |
| TC_COMMON_API void | Trinity::Impl::HexStrToByteArray (std::string_view str, uint8 *out, size_t outlen, bool reverse=false) |
| template<typename Container > | |
| std::string | ByteArrayToHexStr (Container const &c, bool reverse=false) |
| template<size_t Size> | |
| void | HexStrToByteArray (std::string_view str, std::array< uint8, Size > &buf, bool reverse=false) |
| template<size_t Size> | |
| std::array< uint8, Size > | HexStrToByteArray (std::string_view str, bool reverse=false) |
| std::vector< uint8 > | HexStrToByteVector (std::string_view str, bool reverse=false) |
| TC_COMMON_API bool | StringEqualI (std::string_view str1, std::string_view str2) |
| bool | StringStartsWith (std::string_view haystack, std::string_view needle) |
| bool | StringStartsWithI (std::string_view haystack, std::string_view needle) |
| TC_COMMON_API bool | StringContainsStringI (std::string_view haystack, std::string_view needle) |
| template<typename T > | |
| bool | ValueContainsStringI (std::pair< T, std::string_view > const &haystack, std::string_view needle) |
| TC_COMMON_API bool | StringCompareLessI (std::string_view a, std::string_view b) |
| template<class T > | |
| bool | CompareValues (ComparisionType type, T val1, T val2) |
| template<typename E > | |
| constexpr std::underlying_type< E >::type | AsUnderlyingType (E enumValue) |
| template<typename Ret , typename T1 , typename... T> | |
| Ret * | Coalesce (T1 *first, T *... rest) |
| TC_COMMON_API std::string | Trinity::Impl::GetTypeName (std::type_info const &) |
| template<typename T > | |
| std::string | Trinity::GetTypeName () |
| template<typename T > | |
| std::string | Trinity::GetTypeName (T &&v) |
Variables | |
| struct WcharToUpper | wcharToUpper |
| struct WcharToUpperOnlyLatin | wcharToUpperOnlyLatin |
| struct WcharToLower | wcharToLower |
| struct CharToUpper | charToUpper |
| struct CharToLower | charToLower |
| enum ComparisionType |
|
strong |
|
inline |
Definition at line 77 of file Util.h.
References CalculatePct().
Referenced by Unit::ApplyStatPctModifier(), Unit::CalcArmorReducedDamage(), spell_hun_pet_cower::CalculateAmount(), spell_pri_lightwell_renew::CalculateAmount(), spell_pal_sacred_shield::CalculateAmount(), spell_pri_power_word_shield_aura::CalculateAmount(), spell_warr_rend::CalculateAmount(), AuraEffect::CalculateAmount(), Unit::CalculateSpellDamageTaken(), spell_hun_pet_scaling_01::spell_hun_pet_scaling_01_AuraScript::CalculateStaminaAmount(), Spell::Delayed(), Spell::DelayedChannel(), Spell::EffectEnergize(), Spell::EffectSchoolDMG(), Spell::EffectWeaponDmg(), Player::GetQuestXPReward(), Unit::GetTotalAuraMultiplier(), spell_dk_scourge_strike::HandleAfterHit(), spell_pri_shadow_word_death::HandleDamage(), spell_warl_life_tap::HandleDummy(), spell_dk_death_strike::HandleDummy(), spell_dk_scourge_strike::HandleDummy(), spell_sha_healing_stream_totem::HandleDummy(), spell_sha_lava_lash::HandleDummy(), spell_dru_nourish::HandleHeal(), spell_pri_prayer_of_mending_heal::HandleHeal(), spell_hun_ascpect_of_the_viper::HandleProc(), spell_dk_unholy_blight::HandleProc(), spell_pal_infusion_of_light::HandleProc(), spell_sha_glyph_of_earth_shield::HandleProc(), Unit::MeleeDamageBonusDone(), Unit::MeleeDamageBonusTaken(), WorldObject::ModSpellDuration(), spell_warl_siphon_life::OnProc(), Player::RewardHonor(), Unit::RewardRage(), Battleground::RewardReputationToTeam(), spell_dru_wild_growth_aura::SetTickHeal(), Unit::SpellCriticalDamageBonus(), Unit::SpellDamageBonusDone(), Unit::SpellDamageBonusTaken(), Unit::SpellDamagePctDone(), Unit::SpellHealingBonusDone(), Unit::SpellHealingBonusTaken(), Unit::SpellHealingPctDone(), Guardian::UpdateAttackPowerAndDamage(), Guardian::UpdateDamagePhysical(), Unit::UpdateSpeed(), and Guardian::UpdateStats().
|
inline |
Definition at line 83 of file Util.h.
References CalculatePct().
Referenced by Unit::CalcSpellResistedDamage(), Spell::EffectDestroyAllTotems(), Spell::EffectSchoolDMG(), Spell::EffectWeaponDmg(), spell_warl_life_tap::HandleDummy(), spell_warr_deep_wounds::HandleDummy(), AuraEffect::HandlePeriodicManaLeechAuraTick(), spell_deathwhisper_vampiric_might::HandleProc(), spell_hun_glyph_of_arcane_shot::HandleProc(), spell_hun_chimera_shot::HandleScriptEffect(), and Player::RegenerateHealth().
|
constexpr |
Definition at line 554 of file Util.h.
Referenced by Player::_SaveStats(), BattlegroundAV::AddAVCreature(), Player::AddSpellMod(), Unit::ApplyAttackTimePercentMod(), BattlegroundAV::BattlegroundAV(), BattlegroundSA::BattlegroundSA(), spell_warl_pet_scaling_01::spell_warl_pet_scaling_01_AuraScript::CalculateAttackPowerAmount(), spell_warl_pet_scaling_01::spell_warl_pet_scaling_01_AuraScript::CalculateDamageDoneAmount(), BattlegroundSA::CaptureGraveyard(), Player::CastItemCombatSpell(), GameObject::Create(), instance_stratholme::instance_stratholme_InstanceMapScript::DoGateTrap(), Unit::GetAttackTime(), Player::GetDodgeFromAgility(), Player::GetPowerRegen(), Player::GetRatingBonusValue(), Unit::GetTotalStatValue(), spell_warl_life_tap::HandleDummy(), WorldSession::HandleForceSpeedChangeAck(), WorldPackets::Movement::MonsterMove::InitializeSplineData(), Player::InitStatsForLevel(), Guardian::InitStatsForLevel(), SmartAIMgr::IsEventValid(), ObjectMgr::LoadCreatureAddons(), ObjectMgr::LoadCreatureTemplateAddons(), Creature::LoadFromDB(), GameObject::LoadFromDB(), ObjectMgr::LoadVehicleSeatAddon(), instance_stratholme::instance_stratholme_InstanceMapScript::OnGameObjectCreate(), npc_chromie_start::npc_chromie_startAI::OnGossipHello(), npc_chromie_middle::npc_chromie_middleAI::OnGossipHello(), npc_chromie_start::npc_chromie_startAI::OnGossipSelect(), npc_chromie_middle::npc_chromie_middleAI::OnGossipSelect(), Player::Regenerate(), BattlegroundAV::ResetBGSubclass(), BattlegroundSA::ResetObjs(), WorldSession::SendAuctionCommandResult(), WorldSession::SendListInventory(), Spell::SendMountResult(), PlayerMenu::SendQuestGiverStatus(), Trainer::Trainer::SendSpells(), Trainer::Trainer::SendTeachFailure(), npc_webwrap::SetGUID(), Unit::SetMaxPower(), Unit::SetPower(), Creature::SetScriptStringId(), GameObject::SetScriptStringId(), WorldObject::SetVisibilityDistanceOverride(), Unit::SpellCritChanceDone(), CreatureMovementData::ToString(), npc_demolitionist_legoso::npc_demolitionist_legosoAI::UpdateAI(), npc_train_wrecker::npc_train_wreckerAI::UpdateAI(), Player::UpdateArmorPenetration(), Guardian::UpdateAttackPowerAndDamage(), Guardian::UpdateDamagePhysical(), Creature::UpdateEntry(), Creature::UpdateMaxPower(), Guardian::UpdateMaxPower(), Player::UpdateMaxPower(), Player::UpdatePowerRegen(), Player::UpdateRating(), Unit::UpdateResistanceBuffModsMod(), Unit::UpdateStatBuffMod(), and npc_demolitionist_legoso::npc_demolitionist_legosoAI::WaypointReached().
| std::string ByteArrayToHexStr | ( | Container const & | c, |
| bool | reverse = false |
||
| ) |
Definition at line 335 of file Util.h.
References Trinity::Impl::ByteArrayToHexStr().
Referenced by WardenWin::HandleCheckResult(), WardenMac::Init(), WardenWin::Init(), and UpdateFetcher::Update().
|
inline |
Definition at line 71 of file Util.h.
Referenced by spell_dk_anti_magic_shell_raid::Absorb(), spell_dk_anti_magic_shell_self::Absorb(), spell_dk_anti_magic_zone::Absorb(), spell_dk_spell_deflection::Absorb(), spell_dk_will_of_the_necropolis::Absorb(), spell_dru_moonkin_form_passive::Absorb(), spell_dru_primal_tenacity::Absorb(), spell_rog_nerves_of_steel::Absorb(), spell_sha_astral_shift::Absorb(), spell_pal_ardent_defender::Absorb(), AddPct(), ThreatManager::AddThreat(), Player::ApplyBaseModPctValue(), ApplyPct(), Player::ApplySpellMod(), Unit::Attack(), Unit::CalcAbsorbResist(), Unit::CalcArmorReducedDamage(), SpellInfo::CalcPowerCost(), spell_doom_lord_kazzak_mark_of_kazzak::CalculateAmount(), spell_dru_owlkin_frenzy::CalculateAmount(), spell_dru_rip::CalculateAmount(), spell_dru_innervate::CalculateAmount(), spell_gen_lifeblood_aura::CalculateAmount(), spell_gen_mixology_bonus::CalculateAmount(), spell_pal_sacred_shield::CalculateAmount(), spell_pri_power_word_shield_aura::CalculateAmount(), spell_warl_pet_passive::spell_warl_pet_passive_AuraScript::CalculateAmountCritMelee(), spell_warl_pet_passive::spell_warl_pet_passive_AuraScript::CalculateAmountCritSpell(), spell_warl_pet_scaling_03::spell_warl_pet_scaling_03_AuraScript::CalculateArcaneResistanceAmount(), spell_hun_pet_scaling_03::spell_hun_pet_scaling_03_AuraScript::CalculateArcaneResistanceAmount(), spell_warl_pet_scaling_02::spell_warl_pet_scaling_02_AuraScript::CalculateArmorAmount(), spell_hun_pet_scaling_03::spell_hun_pet_scaling_03_AuraScript::CalculateArmorAmount(), spell_warl_pet_scaling_01::spell_warl_pet_scaling_01_AuraScript::CalculateAttackPowerAmount(), spell_hun_pet_scaling_01::spell_hun_pet_scaling_01_AuraScript::CalculateAttackPowerAmount(), spell_hun_pet_scaling_01::spell_hun_pet_scaling_01_AuraScript::CalculateDamageDoneAmount(), spell_warl_pet_scaling_02::spell_warl_pet_scaling_02_AuraScript::CalculateFireResistanceAmount(), spell_hun_pet_scaling_02::spell_hun_pet_scaling_02_AuraScript::CalculateFireResistanceAmount(), spell_warl_pet_scaling_03::spell_warl_pet_scaling_03_AuraScript::CalculateFrostResistanceAmount(), spell_hun_pet_scaling_02::spell_hun_pet_scaling_02_AuraScript::CalculateFrostResistanceAmount(), spell_warl_pet_scaling_02::spell_warl_pet_scaling_02_AuraScript::CalculateIntellectAmount(), spell_warl_pet_scaling_03::spell_warl_pet_scaling_03_AuraScript::CalculateNatureResistanceAmount(), spell_hun_pet_scaling_02::spell_hun_pet_scaling_02_AuraScript::CalculateNatureResistanceAmount(), Player::CalculateReputationGain(), spell_warl_pet_scaling_04::spell_warl_pet_scaling_04_AuraScript::CalculateShadowResistanceAmount(), spell_hun_pet_scaling_03::spell_hun_pet_scaling_03_AuraScript::CalculateShadowResistanceAmount(), spell_warl_pet_scaling_01::spell_warl_pet_scaling_01_AuraScript::CalculateStaminaAmount(), spell_dk_pet_scaling_01::spell_dk_pet_scaling_01_AuraScript::CalculateStrengthAmount(), Player::CastItemCombatSpell(), Pet::CastPetAura(), Unit::CountPctFromCurHealth(), Unit::CountPctFromMaxHealth(), Unit::CountPctFromMaxPower(), Unit::DealDamage(), Spell::DelayedChannel(), Spell::EffectDestroyAllTotems(), Spell::EffectEnergize(), Spell::EffectEnergizePct(), Spell::EffectPowerBurn(), Spell::EffectResurrect(), Spell::EffectSchoolDMG(), Spell::EffectSelfResurrect(), AuctionEntry::GetAuctionCut(), AuctionHouseMgr::GetAuctionDeposit(), AuctionEntry::GetAuctionOutBid(), Unit::GetCombatRatingDamageReduction(), spell_warl_haunt::HandleAfterHit(), spell_pri_renew::HandleApplyEffect(), AuraEffect::HandleAuraModIncreaseHealthPercent(), Aura::HandleAuraSpecificMods(), spell_warr_bloodthirst::HandleDamage(), spell_sha_mana_tide_totem::HandleDummy(), spell_warr_concussion_blow::HandleDummy(), AuraEffect::HandleModPowerCostPCT(), AuraEffect::HandleModTotalPercentStat(), spell_hun_rapid_recuperation::HandlePeriodic(), spell_volkhan_cool_down::HandlePeriodicDummyEffect(), AuraEffect::HandlePeriodicManaLeechAuraTick(), spell_devourer_of_souls_mirrored_soul_proc::HandleProc(), spell_hun_ascpect_of_the_viper::HandleProc(), spell_mage_empowered_fire::HandleProc(), spell_sha_shamanistic_rage::HandleProc(), spell_yogg_saron_grim_reprisal::spell_yogg_saron_grim_reprisal_AuraScript::HandleProc(), spell_pet_guard_dog::HandleProc(), spell_dk_improved_blood_presence_triggered::HandleProc(), spell_dk_necrosis::HandleProc(), spell_dk_unholy_blight::HandleProc(), spell_dk_wandering_plague::HandleProc(), spell_dru_glyph_of_innervate::HandleProc(), spell_dru_glyph_of_rejuvenation::HandleProc(), spell_dru_leader_of_the_pack::HandleProc(), spell_dru_living_seed::HandleProc(), spell_dru_savage_defense::HandleProc(), spell_dru_t3_8p_bonus::HandleProc(), spell_dru_t10_balance_4p_bonus::HandleProc(), spell_hun_piercing_shots::HandleProc(), spell_hun_roar_of_sacrifice::HandleProc(), spell_hun_thrill_of_the_hunt::HandleProc(), spell_item_alchemists_stone::HandleProc(), spell_item_blessing_of_ancient_kings::HandleProc(), spell_item_frozen_shadoweave::HandleProc(), spell_item_necrotic_touch::HandleProc(), spell_item_persistent_shield::HandleProc(), spell_item_pet_healing::HandleProc(), spell_item_charm_witch_doctor::HandleProc(), spell_mage_burnout::HandleProc(), spell_mage_ignite::HandleProc(), spell_mage_magic_absorption::HandleProc(), spell_mage_master_of_elements::HandleProc(), spell_pal_glyph_of_holy_light_dummy::HandleProc(), spell_pal_illumination::HandleProc(), spell_pal_infusion_of_light::HandleProc(), spell_pal_judgement_of_wisdom_mana::HandleProc(), spell_pal_light_s_beacon::HandleProc(), spell_pal_righteous_vengeance::HandleProc(), spell_pal_spiritual_attunement::HandleProc(), spell_pal_sheath_of_light::HandleProc(), spell_pal_t8_2p_bonus::HandleProc(), spell_pri_aq_3p_bonus::HandleProc(), spell_pri_blessed_recovery::HandleProc(), spell_pri_divine_aegis::HandleProc(), spell_pri_glyph_of_prayer_of_healing::HandleProc(), spell_pri_vampiric_embrace::HandleProc(), spell_pri_t10_heal_2p_bonus::HandleProc(), spell_rog_quick_recovery::HandleProc(), spell_sha_ancestral_awakening::HandleProc(), spell_sha_glyph_of_healing_wave::HandleProc(), spell_sha_glyph_of_totem_of_wrath::HandleProc(), spell_sha_item_mana_surge::HandleProc(), spell_sha_nature_guardian::HandleProc(), spell_sha_spirit_hunt::HandleProc(), spell_sha_t8_elemental_4p_bonus::HandleProc(), spell_sha_t9_elemental_4p_bonus::HandleProc(), spell_sha_t10_restoration_4p_bonus::HandleProc(), spell_warl_drain_soul::HandleProc(), spell_warl_soul_leech::HandleProc(), spell_warr_item_t10_prot_4p_bonus::HandleProc(), spell_hun_chimera_shot::HandleScriptEffect(), spell_dru_wild_growth_aura::HandleTickUpdate(), spell_valanar_kinetic_bomb_absorb::OnAbsorb(), spell_blood_queen_essence_of_the_blood_queen::OnProc(), spell_pal_eye_for_an_eye::OnProc(), spell_warl_fel_synergy::OnProc(), spell_warl_siphon_life::OnProc(), spell_warr_damage_shield::OnProc(), spell_dru_lifebloom::OnRemoveEffect(), spell_dru_frenzied_regeneration::PeriodicTick(), Unit::RecalculateObjectScale(), spell_pri_power_word_shield_aura::ReflectDamage(), OPvPCapturePoint::SetCapturePointData(), Unit::SpellBaseDamageBonusDone(), Unit::SpellBaseHealingBonusDone(), spell_dk_anti_magic_shell_self::Trigger(), spell_mage_incanters_absorbtion_base_AuraScript::Trigger(), spell_pal_divine_storm::TriggerHeal(), Guardian::UpdateArmor(), Player::UpdateArmor(), Guardian::UpdateAttackPowerAndDamage(), Player::UpdateAttackPowerAndDamage(), Player::UpdatePowerRegen(), Player::UpdateRating(), Guardian::UpdateResistances(), Unit::UpdateSpeed(), and Guardian::UpdateStats().
| Ret * Coalesce | ( | T1 * | first, |
| T *... | rest | ||
| ) |
| bool CompareValues | ( | ComparisionType | type, |
| T | val1, | ||
| T | val2 | ||
| ) |
Definition at line 532 of file Util.h.
References ABORT, COMP_TYPE_EQ, COMP_TYPE_HIGH, COMP_TYPE_HIGH_EQ, COMP_TYPE_LOW, and COMP_TYPE_LOW_EQ.
Referenced by Condition::Meets(), and AchievementCriteriaData::Meets().
| TC_COMMON_API bool consoleToUtf8 | ( | std::string_view | conStr, |
| std::string & | utf8str | ||
| ) |
Definition at line 550 of file Util.cpp.
References WStrToUtf8().
| TC_COMMON_API uint32 CreatePIDFile | ( | std::string const & | filename | ) |
| TC_COMMON_API time_t GetLocalHourTimestamp | ( | time_t | time, |
| uint8 | hour, | ||
| bool | onlyAfterTime = true |
||
| ) |
Definition at line 100 of file Util.cpp.
References DAY, HOUR, and TimeBreakdown().
Referenced by GetNextDailyResetTime(), InstanceSaveManager::GetSubsequentResetTime(), World::InitCalendarOldEventsDeletionTime(), InstanceSaveManager::LoadResetTimes(), and World::TriggerGuidWarning().
| TC_COMMON_API std::wstring GetMainPartOfName | ( | std::wstring const & | wname, |
| uint32 | declension | ||
| ) |
Definition at line 484 of file Util.cpp.
References isCyrillicCharacter().
Referenced by ObjectMgr::CheckDeclinedNames().
| TC_COMMON_API uint32 GetPID | ( | ) |
Definition at line 338 of file Util.cpp.
Referenced by CreatePIDFile().
| std::array< uint8, Size > HexStrToByteArray | ( | std::string_view | str, |
| bool | reverse = false |
||
| ) |
Definition at line 346 of file Util.h.
References HexStrToByteArray().
| void HexStrToByteArray | ( | std::string_view | str, |
| std::array< uint8, Size > & | buf, | ||
| bool | reverse = false |
||
| ) |
Definition at line 341 of file Util.h.
References Trinity::Impl::HexStrToByteArray().
Referenced by HexStrToByteArray().
|
inline |
Definition at line 353 of file Util.h.
References Trinity::Impl::HexStrToByteArray().
|
inline |
Definition at line 116 of file Util.h.
Referenced by isBasicLatinString(), isExtendedLatinCharacter(), and WcharToUpperOnlyLatin::operator()().
|
inline |
Definition at line 200 of file Util.h.
References isBasicLatinCharacter(), and isNumericOrSpace().
Referenced by isValidString().
|
inline |
Definition at line 146 of file Util.h.
Referenced by GetMainPartOfName(), WorldSession::HandleSetPlayerDeclinedNames(), and isCyrillicString().
|
inline |
Definition at line 216 of file Util.h.
References isCyrillicCharacter(), and isNumericOrSpace().
Referenced by isValidString().
|
inline |
Definition at line 155 of file Util.h.
Referenced by isEastAsianString().
|
inline |
Definition at line 224 of file Util.h.
References isEastAsianCharacter(), and isNumericOrSpace().
Referenced by isValidString().
|
inline |
Definition at line 125 of file Util.h.
References isBasicLatinCharacter().
Referenced by isExtendedLatinString().
|
inline |
Definition at line 208 of file Util.h.
References isExtendedLatinCharacter(), and isNumericOrSpace().
Referenced by isValidString().
| TC_COMMON_API bool IsIPAddress | ( | char const * | ipaddress | ) |
Check if the string is a valid ip address representation.
Definition at line 313 of file Util.cpp.
Referenced by ban_commandscript::HandleBanHelper(), ban_commandscript::HandleBanInfoIPCommand(), and ban_commandscript::HandleUnBanHelper().
|
inline |
Definition at line 186 of file Util.h.
References isNumeric().
|
inline |
Definition at line 176 of file Util.h.
Referenced by misc_commandscript::HandleFreezeCommand(), isNumeric(), isNumericOrSpace(), and server_commandscript::ShutdownServer().
|
inline |
Definition at line 195 of file Util.h.
References isNumeric().
Referenced by isBasicLatinString(), isCyrillicString(), isEastAsianString(), and isExtendedLatinString().
| TC_COMMON_API Optional< int32 > MoneyStringToMoney | ( | std::string const & | moneyString | ) |
Definition at line 216 of file Util.cpp.
References Trinity::Tokenize().
Referenced by modify_commandscript::HandleModifyMoneyCommand().
| TC_COMMON_API bool ReadWinConsole | ( | std::string & | str, |
| size_t | size = 256 |
||
| ) |
| TC_COMMON_API Optional< std::size_t > RemoveCRLF | ( | std::string & | str | ) |
Definition at line 654 of file Util.cpp.
Referenced by CliThread().
|
inline |
Definition at line 89 of file Util.h.
Referenced by Unit::CalcAbsorbResist(), Unit::CalcArmorReducedDamage(), Aura::CalcDispelChance(), Unit::DealMeleeDamage(), spell_sha_flametongue_weapon::HandleProc(), and WorldObject::MagicSpellHitResult().
| TC_COMMON_API std::string secsToTimeString | ( | uint64 | timeInSecs, |
| TimeFormat | timeFormat = TimeFormat::FullText, |
||
| bool | hoursOnly = false |
||
| ) |
Definition at line 115 of file Util.cpp.
References DAY, FullText, HOUR, MINUTE, Numeric, ShortText, and Trinity::StringFormat().
Referenced by GmTicket::FormatMessageString(), ban_commandscript::HandleBanCharacterCommand(), ban_commandscript::HandleBanHelper(), ban_commandscript::HandleBanInfoCharacterCommand(), ban_commandscript::HandleBanInfoHelper(), ban_commandscript::HandleBanInfoIPCommand(), WorldSession::HandleChatMessage(), event_commandscript::HandleEventInfoCommand(), gobject_commandscript::HandleGameObjectTargetCommand(), instance_commandscript::HandleInstanceListBindsCommand(), instance_commandscript::HandleInstanceUnbindCommand(), list_commandscript::HandleListRespawnsCommand(), npc_commandscript::HandleNpcInfoCommand(), misc_commandscript::HandlePInfoCommand(), server_commandscript::HandleServerInfoCommand(), WorldSession::HandleTextEmoteOpcode(), main(), GmTicket::SetChatLog(), World::ShutdownMsg(), and Warden::Update().
|
inline |
Definition at line 95 of file Util.h.
Referenced by MMAP::TerrainBuilder::getHeightTriangle(), MMAP::TerrainBuilder::getLiquidType(), MMAP::TerrainBuilder::isHole(), MMAP::TerrainBuilder::loadVMap(), and PositionOkay().
| TC_COMMON_API bool StringCompareLessI | ( | std::string_view | a, |
| std::string_view | b | ||
| ) |
Definition at line 717 of file Util.cpp.
Referenced by StringCompareLessI_T::operator()().
| TC_COMMON_API bool StringContainsStringI | ( | std::string_view | haystack, |
| std::string_view | needle | ||
| ) |
Definition at line 711 of file Util.cpp.
Referenced by arena_commandscript::HandleArenaLookupCommand(), message_commandscript::HandleChannelSetOwnership(), go_commandscript::HandleGoBossCommand(), go_commandscript::HandleGoInstanceCommand(), and ValueContainsStringI().
| TC_COMMON_API bool StringEqualI | ( | std::string_view | str1, |
| std::string_view | str2 | ||
| ) |
Definition at line 706 of file Util.cpp.
Referenced by Trinity::Impl::StringConvertImpl::For< T, std::enable_if_t< std::is_integral_v< T > &&!std::is_same_v< T, bool > > >::FromString(), Trinity::Impl::StringConvertImpl::For< bool, void >::FromString(), Trinity::Impl::StringConvertImpl::For< T, std::enable_if_t< std::is_floating_point_v< T > > >::FromString(), ArenaTeamMgr::GetArenaTeamByName(), Trinity::Impl::ChatCommands::ChatCommandNode::GetAutoCompletionsFor(), GuildMgr::GetGuildByName(), debug_commandscript::HandleDebugTransportCommand(), misc_commandscript::HandleLinkGraveCommand(), misc_commandscript::HandleNearGraveCommand(), npc_commandscript::HandleNpcAddTempSpawnCommand(), Trinity::Impl::ChatCommands::ArgInfo< T, std::enable_if_t< std::is_enum_v< T > > >::Match(), Trinity::Impl::ChatCommands::ChatCommandNode::SendCommandHelpFor(), StringStartsWithI(), Trinity::ChatCommands::ExactSequence< chars >::TryConsume(), and Trinity::Impl::ChatCommands::ChatCommandNode::TryExecuteCommand().
|
inline |
Definition at line 363 of file Util.h.
Referenced by cast_commandscript::GetTriggerFlags(), AddonChannelCommandHandler::ParseCommands(), Warden::ProcessLuaCheckResponse(), and Trinity::Impl::ChatCommands::ArgInfo< Trinity::ChatCommands::Variant< Ts... > >::TryAtIndex().
|
inline |
Definition at line 364 of file Util.h.
References StringEqualI().
Referenced by Trinity::Impl::ChatCommands::FilteredCommandListIterator::_skip(), and Trinity::Impl::ChatCommands::ArgInfo< T, std::enable_if_t< std::is_enum_v< T > > >::Match().
| TC_COMMON_API void strToLower | ( | std::string & | str | ) |
Definition at line 482 of file Util.cpp.
References charToLower.
Referenced by ExtractGameobjectModels(), and IpLocationStore::Load().
| TC_COMMON_API void strToUpper | ( | std::string & | str | ) |
Definition at line 481 of file Util.cpp.
References charToUpper.
| TC_COMMON_API tm TimeBreakdown | ( | time_t | t | ) |
Definition at line 93 of file Util.cpp.
Referenced by GetLocalHourTimestamp(), GetNextMonthlyResetTime(), GetNextWeeklyResetTime(), and Trinity::Timezone::GetSystemZoneOffsetAt().
| TC_COMMON_API uint32 TimeStringToSecs | ( | std::string const & | timestring | ) |
Definition at line 258 of file Util.cpp.
References DAY, HOUR, and MINUTE.
Referenced by World::BanAccount(), World::BanCharacter(), ban_commandscript::HandleBanCharacterCommand(), ban_commandscript::HandleBanHelper(), and server_commandscript::ShutdownServer().
| TC_COMMON_API std::string TimeToHumanReadable | ( | time_t | t | ) |
Definition at line 303 of file Util.cpp.
Referenced by debug_commandscript::HandleDebugQuestResetCommand().
| TC_COMMON_API std::string TimeToTimestampStr | ( | time_t | t | ) |
Definition at line 290 of file Util.cpp.
References Trinity::StringFormat().
Referenced by ban_commandscript::HandleBanInfoCharacterCommand(), character_commandscript::HandleCharacterDeletedListHelper(), event_commandscript::HandleEventInfoCommand(), and list_commandscript::HandleListMailCommand().
| TC_COMMON_API bool Utf8FitTo | ( | std::string_view | str, |
| std::wstring_view | search | ||
| ) |
Definition at line 565 of file Util.cpp.
References Utf8toWStr(), and wstrToLower().
Referenced by AuctionHouseObject::BuildListAuctionItems(), learn_commandscript::HandleLearnAllRecipesCommand(), lookup_commandscript::HandleLookupAreaCommand(), lookup_commandscript::HandleLookupCreatureCommand(), lookup_commandscript::HandleLookupEventCommand(), lookup_commandscript::HandleLookupFactionCommand(), lookup_commandscript::HandleLookupItemCommand(), lookup_commandscript::HandleLookupItemSetCommand(), lookup_commandscript::HandleLookupMapCommand(), lookup_commandscript::HandleLookupObjectCommand(), lookup_commandscript::HandleLookupQuestCommand(), lookup_commandscript::HandleLookupSkillCommand(), lookup_commandscript::HandleLookupSpellCommand(), lookup_commandscript::HandleLookupTaxiNodeCommand(), lookup_commandscript::HandleLookupTitleCommand(), WorldSession::HandleWhoOpcode(), and list_commandscript::ShouldListAura().
| TC_COMMON_API size_t utf8length | ( | std::string & | utf8str | ) |
Definition at line 349 of file Util.cpp.
Referenced by AccountMgr::ChangeEmail(), AccountMgr::ChangePassword(), AccountMgr::ChangeRegEmail(), AccountMgr::ChangeUsername(), AccountMgr::CreateAccount(), and WorldSession::HandleJoinChannel().
| TC_COMMON_API void utf8printf | ( | FILE * | out, |
| const char * | str, | ||
| ... | |||
| ) |
Definition at line 581 of file Util.cpp.
References vutf8printf().
Referenced by AppenderConsole::Print().
| TC_COMMON_API bool utf8ToConsole | ( | std::string_view | utf8str, |
| std::string & | conStr | ||
| ) |
Definition at line 533 of file Util.cpp.
References Utf8toWStr().
| TC_COMMON_API bool Utf8ToUpperOnlyLatin | ( | std::string & | utf8String | ) |
Definition at line 610 of file Util.cpp.
References Utf8toWStr(), wcharToUpperOnlyLatin, and WStrToUtf8().
Referenced by AccountMgr::ChangeEmail(), AccountMgr::ChangePassword(), AccountMgr::ChangeRegEmail(), AccountMgr::ChangeUsername(), RASession::CheckAccessLevel(), AccountMgr::CheckEmail(), RASession::CheckPassword(), AccountMgr::CheckPassword(), AccountMgr::CreateAccount(), account_commandscript::HandleAccountDeleteCommand(), account_commandscript::HandleAccountSet2FACommand(), account_commandscript::HandleAccountSetAddonCommand(), account_commandscript::HandleAccountSetEmailCommand(), account_commandscript::HandleAccountSetPasswordCommand(), account_commandscript::HandleAccountSetRegEmailCommand(), account_commandscript::HandleAccountSetSecLevelCommand(), ban_commandscript::HandleBanHelper(), ban_commandscript::HandleBanInfoAccountCommand(), debug_commandscript::HandleDebugQuestResetCommand(), lookup_commandscript::HandleLookupPlayerAccountCommand(), misc_commandscript::HandleMuteHistoryCommand(), ban_commandscript::HandleUnBanHelper(), PlayerDump::InitializeTables(), AccountInfo::LoadResult(), StringsEqualCaseInsensitive(), and Trinity::ChatCommands::AccountIdentifier::TryConsume().
| TC_COMMON_API bool Utf8toWStr | ( | char const * | utf8str, |
| size_t | csize, | ||
| wchar_t * | wstr, | ||
| size_t & | wsize | ||
| ) |
Definition at line 383 of file Util.cpp.
References Trinity::CheckedBufferOutputIterator< T >::remaining().
Referenced by ObjectMgr::AddGameTele(), ObjectMgr::CheckDeclinedNames(), ObjectMgr::CheckPetName(), ObjectMgr::CheckPlayerName(), ChannelMgr::CreateCustomChannel(), ObjectMgr::DeleteGameTele(), ChannelMgr::GetChannel(), ChannelMgr::GetChannelForPlayerByNamePart(), ChannelMgr::GetCustomChannel(), ObjectMgr::GetGameTele(), ObjectMgr::GetGameTeleExactName(), WorldSession::HandleAuctionListItems(), lookup_commandscript::HandleLookupAreaCommand(), lookup_commandscript::HandleLookupCreatureCommand(), lookup_commandscript::HandleLookupEventCommand(), lookup_commandscript::HandleLookupFactionCommand(), lookup_commandscript::HandleLookupItemCommand(), lookup_commandscript::HandleLookupItemSetCommand(), lookup_commandscript::HandleLookupMapCommand(), lookup_commandscript::HandleLookupObjectCommand(), lookup_commandscript::HandleLookupQuestCommand(), lookup_commandscript::HandleLookupSkillCommand(), lookup_commandscript::HandleLookupSpellCommand(), lookup_commandscript::HandleLookupTaxiNodeCommand(), lookup_commandscript::HandleLookupTeleCommand(), lookup_commandscript::HandleLookupTitleCommand(), modify_commandscript::HandleModifyRepCommand(), WorldSession::HandlePetRename(), WorldSession::HandleSetPlayerDeclinedNames(), WorldSession::HandleWhoOpcode(), ObjectMgr::IsReservedName(), ObjectMgr::IsValidCharterName(), ChannelMgr::LoadFromDB(), ObjectMgr::LoadGameTele(), ObjectMgr::LoadReservedPlayersNames(), normalizePlayerName(), Trinity::ChatCommands::WTail::TryConsume(), Trinity::Impl::ChatCommands::ArgInfo< std::wstring, void >::TryConsume(), WhoListStorageMgr::Update(), Utf8FitTo(), utf8ToConsole(), Utf8ToUpperOnlyLatin(), vutf8printf(), and WriteWinConsole().
| TC_COMMON_API bool Utf8toWStr | ( | std::string_view | utf8str, |
| std::wstring & | wstr | ||
| ) |
Definition at line 417 of file Util.cpp.
Referenced by Utf8toWStr().
|
inline |
Definition at line 103 of file Util.h.
References Utf8toWStr().
| TC_COMMON_API void utf8truncate | ( | std::string & | utf8str, |
| size_t | len | ||
| ) |
Definition at line 362 of file Util.cpp.
Referenced by PlayerSocial::SetFriendNote().
|
inline |
Definition at line 367 of file Util.h.
References StringContainsStringI().
| TC_COMMON_API void vutf8printf | ( | FILE * | out, |
| const char * | str, | ||
| va_list * | ap | ||
| ) |
| TC_COMMON_API bool WriteWinConsole | ( | std::string_view | str, |
| bool | error = false |
||
| ) |
Definition at line 641 of file Util.cpp.
References Utf8toWStr().
Referenced by AppenderConsole::Print(), and utf8print().
| TC_COMMON_API void wstrToLower | ( | std::wstring & | str | ) |
Definition at line 480 of file Util.cpp.
References wcharToLower.
Referenced by ObjectMgr::AddGameTele(), ObjectMgr::CheckPlayerName(), ChannelMgr::CreateCustomChannel(), ObjectMgr::DeleteGameTele(), ChannelMgr::GetChannel(), ChannelMgr::GetChannelForPlayerByNamePart(), ChannelMgr::GetCustomChannel(), ObjectMgr::GetGameTele(), ObjectMgr::GetGameTeleExactName(), WorldSession::HandleAuctionListItems(), learn_commandscript::HandleLearnAllRecipesCommand(), lookup_commandscript::HandleLookupAreaCommand(), lookup_commandscript::HandleLookupCreatureCommand(), lookup_commandscript::HandleLookupEventCommand(), lookup_commandscript::HandleLookupFactionCommand(), lookup_commandscript::HandleLookupItemCommand(), lookup_commandscript::HandleLookupItemSetCommand(), lookup_commandscript::HandleLookupMapCommand(), lookup_commandscript::HandleLookupObjectCommand(), lookup_commandscript::HandleLookupQuestCommand(), lookup_commandscript::HandleLookupSkillCommand(), lookup_commandscript::HandleLookupSpellCommand(), lookup_commandscript::HandleLookupTaxiNodeCommand(), lookup_commandscript::HandleLookupTeleCommand(), lookup_commandscript::HandleLookupTitleCommand(), modify_commandscript::HandleModifyRepCommand(), WorldSession::HandleWhoOpcode(), ObjectMgr::IsReservedName(), list_commandscript::ListAurasCommand(), ObjectMgr::LoadGameTele(), ObjectMgr::LoadReservedPlayersNames(), normalizePlayerName(), WhoListStorageMgr::Update(), and Utf8FitTo().
| TC_COMMON_API void wstrToUpper | ( | std::wstring & | str | ) |
Definition at line 479 of file Util.cpp.
References wcharToUpper.
| TC_COMMON_API bool WStrToUtf8 | ( | std::wstring_view | wstr, |
| std::string & | utf8str | ||
| ) |
| TC_COMMON_API bool WStrToUtf8 | ( | wchar_t const * | wstr, |
| size_t | size, | ||
| std::string & | utf8str | ||
| ) |
Definition at line 433 of file Util.cpp.
Referenced by consoleToUtf8(), normalizePlayerName(), ReadWinConsole(), and Utf8ToUpperOnlyLatin().
| struct CharToLower charToLower |
Referenced by MPQ::FileNameMatchesArchivePattern(), MPQ::ResolveArchiveFileList(), and strToLower().
| struct CharToUpper charToUpper |
Referenced by strToUpper().
| struct WcharToLower wcharToLower |
Referenced by wstrToLower().
| struct WcharToUpper wcharToUpper |
Referenced by normalizePlayerName(), WcharToUpperOnlyLatin::operator()(), and wstrToUpper().
| struct WcharToUpperOnlyLatin wcharToUpperOnlyLatin |
Referenced by Utf8ToUpperOnlyLatin().