Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions indra/cmake/Copy3rdPartyLibs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ if(WINDOWS)
set(release_src_dir "${ARCH_PREBUILT_DIRS_RELEASE}")
set(release_files
openjp2.dll
SDL3.dll
)

# Filenames are different for 32/64 bit BugSplat file and we don't
Expand Down Expand Up @@ -175,6 +176,7 @@ elseif(DARWIN)
set(release_src_dir "${ARCH_PREBUILT_DIRS_RELEASE}")
set(release_files
libndofdev.dylib
libSDL3.dylib
)

if (TARGET ll::discord_sdk)
Expand Down
17 changes: 6 additions & 11 deletions indra/cmake/SDL3.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,11 @@ else()
set(USE_SDL_WINDOW OFF CACHE BOOL "Build with SDL window backend")
endif (LINUX)

if(USE_SDL_WINDOW)
use_system_binary(SDL3)
use_prebuilt_binary(SDL3)
use_prebuilt_binary(SDL3)

find_library( SDL3_LIBRARY
NAMES SDL3 SDL3.lib libSDL3.so libSDL3.dylib
PATHS "${LIBS_PREBUILT_DIR}/lib/release" REQUIRED)

target_link_libraries(ll::SDL3 INTERFACE ${SDL3_LIBRARY})
target_include_directories(ll::SDL3 SYSTEM INTERFACE "${LIBS_PREBUILT_DIR}/include/")

endif(USE_SDL_WINDOW)
find_library( SDL3_LIBRARY
NAMES SDL3 SDL3.lib libSDL3.so libSDL3.dylib
PATHS "${LIBS_PREBUILT_DIR}/lib/release" REQUIRED)

target_link_libraries(ll::SDL3 INTERFACE ${SDL3_LIBRARY})
target_include_directories(ll::SDL3 SYSTEM INTERFACE "${LIBS_PREBUILT_DIR}/include/")
14 changes: 10 additions & 4 deletions indra/llcommon/llinitparam.h
Original file line number Diff line number Diff line change
Expand Up @@ -1792,8 +1792,13 @@ namespace LLInitParam

// implicit conversion
operator const container_t&() const { return mValues; }
operator container_t&() { return mValues; }
// explicit conversion
const container_t& operator()() const { return mValues; }
container_t& operator()() { return mValues; }
// direct Nth item access
const typename NAME_VALUE_LOOKUP::type_value_t& operator()(size_t index) const { return mValues[index]; }
typename NAME_VALUE_LOOKUP::type_value_t& operator()(size_t index) { return mValues[index]; }

iterator begin() { return mValues.begin(); }
iterator end() { return mValues.end(); }
Expand Down Expand Up @@ -2123,13 +2128,13 @@ namespace LLInitParam
class Multiple : public TypedParam<T, NAME_VALUE_LOOKUP, true>
{
typedef TypedParam<T, NAME_VALUE_LOOKUP, true> super_t;
typedef Multiple<T, RANGE, NAME_VALUE_LOOKUP> self_t;
typedef typename super_t::container_t container_t;
typedef Multiple<T, RANGE, NAME_VALUE_LOOKUP> self_t;
typedef typename super_t::container_t container_t;
typedef typename super_t::value_t value_t;

public:
typedef typename super_t::iterator iterator;
typedef typename super_t::const_iterator const_iterator;
typedef typename super_t::iterator iterator;
typedef typename super_t::const_iterator const_iterator;

using super_t::operator();
using super_t::operator const container_t&;
Expand Down Expand Up @@ -2857,3 +2862,4 @@ namespace LLInitParam


#endif // LL_LLPARAM_H

8 changes: 4 additions & 4 deletions indra/llcommon/llkeybind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ void LLKeyData::reset()
mIgnoreMasks = false;
}

bool LLKeyData::operator==(const LLKeyData& rhs)
bool LLKeyData::operator==(const LLKeyData& rhs) const
{
if (mMouse != rhs.mMouse) return false;
if (mKey != rhs.mKey) return false;
Expand All @@ -123,7 +123,7 @@ bool LLKeyData::operator==(const LLKeyData& rhs)
return true;
}

bool LLKeyData::operator!=(const LLKeyData& rhs)
bool LLKeyData::operator!=(const LLKeyData& rhs) const
{
if (mMouse != rhs.mMouse) return true;
if (mKey != rhs.mKey) return true;
Expand Down Expand Up @@ -170,7 +170,7 @@ LLKeyBind::LLKeyBind(const LLSD &key_bind)
}
}

bool LLKeyBind::operator==(const LLKeyBind& rhs)
bool LLKeyBind::operator==(const LLKeyBind& rhs) const
{
auto size = mData.size();
if (size != rhs.mData.size()) return false;
Expand All @@ -183,7 +183,7 @@ bool LLKeyBind::operator==(const LLKeyBind& rhs)
return true;
}

bool LLKeyBind::operator!=(const LLKeyBind& rhs)
bool LLKeyBind::operator!=(const LLKeyBind& rhs) const
{
auto size = mData.size();
if (size != rhs.mData.size()) return true;
Expand Down
8 changes: 4 additions & 4 deletions indra/llcommon/llkeybind.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ class LL_COMMON_API LLKeyData
bool isEmpty() const;
bool empty() const { return isEmpty(); };
void reset();
bool operator==(const LLKeyData& rhs);
bool operator!=(const LLKeyData& rhs);
bool operator==(const LLKeyData& rhs) const;
bool operator!=(const LLKeyData& rhs) const;

bool canHandle(const LLKeyData& data) const;
bool canHandle(EMouseClickType mouse, KEY key, MASK mask) const;
Expand All @@ -63,8 +63,8 @@ class LLKeyBind
LLKeyBind() {}
LLKeyBind(const LLSD &key_bind);

bool operator==(const LLKeyBind& rhs);
bool operator!=(const LLKeyBind& rhs);
bool operator==(const LLKeyBind& rhs) const;
bool operator!=(const LLKeyBind& rhs) const;
bool isEmpty() const;
bool empty() const { return isEmpty(); };

Expand Down
25 changes: 25 additions & 0 deletions indra/llcommon/llsd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -973,6 +973,31 @@ void LLSD::clear() { Impl::assignUndefined(impl); }

LLSD::Type LLSD::type() const { return safe(impl).type(); }

bool LLSD::isEmpty() const
{
switch (type())
{
case TypeUndefined:
return true; // Always empty
case TypeBinary:
return !asBoolean(); // Empty when default
case TypeInteger:
return !asInteger(); // Empty when default
case TypeReal:
return !asReal(); // Empty when default
case TypeString:
case TypeURI:
return asString().empty(); // Empty natively
case TypeArray:
case TypeMap:
return !size(); // Empty natively
default:;
}
// All other value types (TypeDate) don't have default values so can't be empty
return false;
}


// Scalar Constructors
LLSD::LLSD(Boolean v) : impl(0) { ALLOC_LLSD_OBJECT; assign(v); }
LLSD::LLSD(Integer v) : impl(0) { ALLOC_LLSD_OBJECT; assign(v); }
Expand Down
1 change: 1 addition & 0 deletions indra/llcommon/llsd.h
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,7 @@ class LL_COMMON_API LLSD
bool isBinary() const { return type() == TypeBinary; }
bool isMap() const { return type() == TypeMap; }
bool isArray() const { return type() == TypeArray; }
bool isEmpty() const;
//@}

/** @name Automatic Cast Protection
Expand Down
23 changes: 16 additions & 7 deletions indra/llcommon/llstring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1119,18 +1119,27 @@ void LLStringOps::setupDayFormat(const std::string& data)
}


std::string LLStringOps::getDatetimeCode (std::string key)
std::string LLStringOps::getDatetimeCode(const std::string& key)
{
std::map<std::string, std::string>::iterator iter;
std::map<std::string, std::string>::iterator iter = datetimeToCodes.find(key);
return iter == datetimeToCodes.end() ? LLStringUtil::null : iter->second;
}

iter = datetimeToCodes.find (key);
if (iter != datetimeToCodes.end())
void LLStringOps::splitString(const std::string& text, char delimiter,
std::function<void(const std::string&)> handler)
{
std::size_t from = 0;
for (std::size_t i = 0; i < text.size(); ++i)
{
return iter->second;
if (text[i] == delimiter)
{
handler(text.substr(from, i - from));
from = i + 1;
}
}
else
if (from <= text.size())
{
return std::string("");
handler(text.substr(from));
}
}

Expand Down
65 changes: 64 additions & 1 deletion indra/llcommon/llstring.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
//#include <locale>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <vector>
#include <map>
#include "llformat.h"
Expand Down Expand Up @@ -210,7 +211,10 @@ class LL_COMMON_API LLStringOps
// currently in daylight savings time?
static bool getPacificDaylightTime(void) { return sPacificDaylightTime;}

static std::string getDatetimeCode (std::string key);
static std::string getDatetimeCode (const std::string& key);

static void splitString(const std::string& text, char delimiter,
std::function<void(const std::string&)> handler);

// Express a value like 1234567 as "1.23M"
static std::string getReadableNumber(F64 num);
Expand Down Expand Up @@ -433,6 +437,65 @@ class LLStringUtilBase
static bool isPartOfWord(T c) { return (c == (T)'_') || LLStringOps::isAlnum(c); }


// Join non-empty strings from values using value itself and delimiter
template<class C>
static std::string join(const C& values, T delimiter = ',')
{
std::string result;
for (const std::string& value : values)
{
if (!value.empty())
{
if (!result.empty())
{
result += delimiter;
}
result += value;
}
}
return result;
}

// Join non-empty strings from values using stringify(value) and delimiter
template<class C, class V>
static std::string join(const C& values, std::function<std::string(const V&)> stringify, T delimiter = ',')
{
std::string result;
for (const V& value : values)
{
std::string string = stringify(value);
if (!string.empty())
{
if (!result.empty())
{
result += delimiter;
}
result += string;
}
}
return result;
}

// Join non-empty strings from values using stringify(index, value) and delimiter
template<class C, class V>
static std::string join(const C& values, std::function<std::string(size_t index, const V&)> stringify, T delimiter = ',')
{
std::string result;
for (size_t i = 0; i < values.size(); ++i)
{
std::string string = stringify(i, values[i]);
if (!string.empty())
{
if (!result.empty())
{
result += delimiter;
}
result += string;
}
}
return result;
}

#ifdef _DEBUG
LL_COMMON_API static void testHarness();
#endif
Expand Down
2 changes: 2 additions & 0 deletions indra/llmessage/message_prehash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1403,3 +1403,5 @@ char const* const _PREHASH_Experience = LLMessageStringTable::getInstance()->get
char const* const _PREHASH_ExperienceID = LLMessageStringTable::getInstance()->getString("ExperienceID");
char const* const _PREHASH_LargeGenericMessage = LLMessageStringTable::getInstance()->getString("LargeGenericMessage");
char const* const _PREHASH_MetaData = LLMessageStringTable::getInstance()->getString("MetaData");
char const* const _PREHASH_GameControlInput = LLMessageStringTable::getInstance()->getString("GameControlInput");
char const* const _PREHASH_AxisData = LLMessageStringTable::getInstance()->getString("AxisData");
2 changes: 2 additions & 0 deletions indra/llmessage/message_prehash.h
Original file line number Diff line number Diff line change
Expand Up @@ -1404,5 +1404,7 @@ extern char const* const _PREHASH_Experience;
extern char const* const _PREHASH_ExperienceID;
extern char const* const _PREHASH_LargeGenericMessage;
extern char const* const _PREHASH_MetaData;
extern char const* const _PREHASH_GameControlInput;
extern char const* const _PREHASH_AxisData;

#endif
Loading
Loading