Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package Registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
ad768971
Commit
ad768971
authored
4 years ago
by
Rye Mutt
Browse files
Options
Downloads
Patches
Plain Diff
Convert LLUIColorTable to string_view
parent
29097c76
No related branches found
No related tags found
1 merge request
!4
Convert and modernize various parts of the viewer to use string_view and move semantics
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
indra/llui/llui.cpp
+1
-1
1 addition, 1 deletion
indra/llui/llui.cpp
indra/llui/lluicolortable.cpp
+5
-5
5 additions, 5 deletions
indra/llui/lluicolortable.cpp
indra/llui/lluicolortable.h
+5
-5
5 additions, 5 deletions
indra/llui/lluicolortable.h
with
11 additions
and
11 deletions
indra/llui/llui.cpp
+
1
−
1
View file @
ad768971
...
@@ -531,7 +531,7 @@ namespace LLInitParam
...
@@ -531,7 +531,7 @@ namespace LLInitParam
{
{
if
(
control
.
isProvided
()
&&
!
control
().
empty
())
if
(
control
.
isProvided
()
&&
!
control
().
empty
())
{
{
updateValue
(
LLUIColorTable
::
instance
().
getColor
(
control
));
updateValue
(
LLUIColorTable
::
instance
().
getColor
(
control
.
getValue
()
));
}
}
else
else
{
{
...
...
This diff is collapsed.
Click to expand it.
indra/llui/lluicolortable.cpp
+
5
−
5
View file @
ad768971
...
@@ -63,7 +63,7 @@ void LLUIColorTable::insertFromParams(const Params& p, string_color_map_t& table
...
@@ -63,7 +63,7 @@ void LLUIColorTable::insertFromParams(const Params& p, string_color_map_t& table
ColorEntryParams
color_entry
=
*
it
;
ColorEntryParams
color_entry
=
*
it
;
if
(
color_entry
.
color
.
value
.
isChosen
())
if
(
color_entry
.
color
.
value
.
isChosen
())
{
{
setColor
(
color_entry
.
name
,
color_entry
.
color
.
value
,
table
);
setColor
(
color_entry
.
name
.
getValue
()
,
color_entry
.
color
.
value
,
table
);
}
}
else
else
{
{
...
@@ -176,7 +176,7 @@ void LLUIColorTable::clear()
...
@@ -176,7 +176,7 @@ void LLUIColorTable::clear()
clearTable
(
mUserSetColors
);
clearTable
(
mUserSetColors
);
}
}
LLUIColor
LLUIColorTable
::
getColor
(
const
std
::
string
&
name
,
const
LLColor4
&
default_color
)
const
LLUIColor
LLUIColorTable
::
getColor
(
std
::
string
_view
name
,
const
LLColor4
&
default_color
)
const
{
{
string_color_map_t
::
const_iterator
iter
=
mUserSetColors
.
find
(
name
);
string_color_map_t
::
const_iterator
iter
=
mUserSetColors
.
find
(
name
);
...
@@ -196,7 +196,7 @@ LLUIColor LLUIColorTable::getColor(const std::string& name, const LLColor4& defa
...
@@ -196,7 +196,7 @@ LLUIColor LLUIColorTable::getColor(const std::string& name, const LLColor4& defa
}
}
// update user color, loaded colors are parsed on initialization
// update user color, loaded colors are parsed on initialization
void
LLUIColorTable
::
setColor
(
const
std
::
string
&
name
,
const
LLColor4
&
color
)
void
LLUIColorTable
::
setColor
(
std
::
string
_view
name
,
const
LLColor4
&
color
)
{
{
setColor
(
name
,
color
,
mUserSetColors
);
setColor
(
name
,
color
,
mUserSetColors
);
setColor
(
name
,
color
,
mLoadedColors
);
setColor
(
name
,
color
,
mLoadedColors
);
...
@@ -254,7 +254,7 @@ void LLUIColorTable::saveUserSettings() const
...
@@ -254,7 +254,7 @@ void LLUIColorTable::saveUserSettings() const
}
}
}
}
bool
LLUIColorTable
::
colorExists
(
const
std
::
string
&
color_name
)
const
bool
LLUIColorTable
::
colorExists
(
std
::
string
_view
color_name
)
const
{
{
return
((
mLoadedColors
.
find
(
color_name
)
!=
mLoadedColors
.
end
())
return
((
mLoadedColors
.
find
(
color_name
)
!=
mLoadedColors
.
end
())
||
(
mUserSetColors
.
find
(
color_name
)
!=
mUserSetColors
.
end
()));
||
(
mUserSetColors
.
find
(
color_name
)
!=
mUserSetColors
.
end
()));
...
@@ -272,7 +272,7 @@ void LLUIColorTable::clearTable(string_color_map_t& table)
...
@@ -272,7 +272,7 @@ void LLUIColorTable::clearTable(string_color_map_t& table)
// this method inserts a color into the table if it does not exist
// this method inserts a color into the table if it does not exist
// if the color already exists it changes the color
// if the color already exists it changes the color
void
LLUIColorTable
::
setColor
(
const
std
::
string
&
name
,
const
LLColor4
&
color
,
string_color_map_t
&
table
)
void
LLUIColorTable
::
setColor
(
std
::
string
_view
name
,
const
LLColor4
&
color
,
string_color_map_t
&
table
)
{
{
string_color_map_t
::
iterator
it
=
table
.
lower_bound
(
name
);
string_color_map_t
::
iterator
it
=
table
.
lower_bound
(
name
);
if
(
it
!=
table
.
end
()
if
(
it
!=
table
.
end
()
...
...
This diff is collapsed.
Click to expand it.
indra/llui/lluicolortable.h
+
5
−
5
View file @
ad768971
...
@@ -42,7 +42,7 @@ class LLUIColorTable final : public LLSingleton<LLUIColorTable>
...
@@ -42,7 +42,7 @@ class LLUIColorTable final : public LLSingleton<LLUIColorTable>
LOG_CLASS
(
LLUIColorTable
);
LOG_CLASS
(
LLUIColorTable
);
// consider using sorted vector, can be much faster
// consider using sorted vector, can be much faster
typedef
std
::
map
<
std
::
string
,
LLUIColor
>
string_color_map_t
;
typedef
std
::
map
<
std
::
string
,
LLUIColor
,
std
::
less
<>
>
string_color_map_t
;
public:
public:
struct
ColorParams
:
LLInitParam
::
ChoiceBlock
<
ColorParams
>
struct
ColorParams
:
LLInitParam
::
ChoiceBlock
<
ColorParams
>
...
@@ -75,13 +75,13 @@ class LLUIColorTable final : public LLSingleton<LLUIColorTable>
...
@@ -75,13 +75,13 @@ class LLUIColorTable final : public LLSingleton<LLUIColorTable>
void
clear
();
void
clear
();
// color lookup
// color lookup
LLUIColor
getColor
(
const
std
::
string
&
name
,
const
LLColor4
&
default_color
=
LLColor4
::
magenta
)
const
;
LLUIColor
getColor
(
std
::
string
_view
,
const
LLColor4
&
default_color
=
LLColor4
::
magenta
)
const
;
// if the color is in the table, it's value is changed, otherwise it is added
// if the color is in the table, it's value is changed, otherwise it is added
void
setColor
(
const
std
::
string
&
name
,
const
LLColor4
&
color
);
void
setColor
(
std
::
string
_view
name
,
const
LLColor4
&
color
);
// returns true if color_name exists in the table
// returns true if color_name exists in the table
bool
colorExists
(
const
std
::
string
&
color_name
)
const
;
bool
colorExists
(
std
::
string
_view
color_name
)
const
;
// loads colors from settings files
// loads colors from settings files
bool
loadFromSettings
();
bool
loadFromSettings
();
...
@@ -95,7 +95,7 @@ class LLUIColorTable final : public LLSingleton<LLUIColorTable>
...
@@ -95,7 +95,7 @@ class LLUIColorTable final : public LLSingleton<LLUIColorTable>
void
insertFromParams
(
const
Params
&
p
,
string_color_map_t
&
table
);
void
insertFromParams
(
const
Params
&
p
,
string_color_map_t
&
table
);
void
clearTable
(
string_color_map_t
&
table
);
void
clearTable
(
string_color_map_t
&
table
);
void
setColor
(
const
std
::
string
&
name
,
const
LLColor4
&
color
,
string_color_map_t
&
table
);
void
setColor
(
std
::
string
_view
name
,
const
LLColor4
&
color
,
string_color_map_t
&
table
);
string_color_map_t
mLoadedColors
;
string_color_map_t
mLoadedColors
;
string_color_map_t
mUserSetColors
;
string_color_map_t
mUserSetColors
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment