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
57c30517
Commit
57c30517
authored
13 years ago
by
Kadah_Coba
Browse files
Options
Downloads
Patches
Plain Diff
Changes for STORM-1315 LLCalc
Removed dynamic allocation on mVariables and mConstants CS cleanup
parent
bb410e95
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
indra/llmath/llcalc.cpp
+13
-20
13 additions, 20 deletions
indra/llmath/llcalc.cpp
indra/llmath/llcalc.h
+3
-3
3 additions, 3 deletions
indra/llmath/llcalc.h
indra/llui/llspinctrl.cpp
+1
-9
1 addition, 9 deletions
indra/llui/llspinctrl.cpp
with
17 additions
and
32 deletions
indra/llmath/llcalc.cpp
+
13
−
20
View file @
57c30517
...
...
@@ -54,27 +54,20 @@ LLCalc* LLCalc::sInstance = NULL;
LLCalc
::
LLCalc
()
:
mLastErrorPos
(
0
)
{
// mUserVariables = new calc_map_t;
mVariables
=
new
calc_map_t
;
mConstants
=
new
calc_map_t
;
// Init table of constants
(
*
mConstants
)
[
"PI"
]
=
F_PI
;
(
*
mConstants
)
[
"TWO_PI"
]
=
F_TWO_PI
;
(
*
mConstants
)
[
"PI_BY_TWO"
]
=
F_PI_BY_TWO
;
(
*
mConstants
)
[
"SQRT_TWO_PI"
]
=
F_SQRT_TWO_PI
;
(
*
mConstants
)
[
"SQRT2"
]
=
F_SQRT2
;
(
*
mConstants
)
[
"SQRT3"
]
=
F_SQRT3
;
(
*
mConstants
)
[
"DEG_TO_RAD"
]
=
DEG_TO_RAD
;
(
*
mConstants
)
[
"RAD_TO_DEG"
]
=
RAD_TO_DEG
;
(
*
mConstants
)
[
"GRAVITY"
]
=
GRAVITY
;
mConstants
[
"PI"
]
=
F_PI
;
mConstants
[
"TWO_PI"
]
=
F_TWO_PI
;
mConstants
[
"PI_BY_TWO"
]
=
F_PI_BY_TWO
;
mConstants
[
"SQRT_TWO_PI"
]
=
F_SQRT_TWO_PI
;
mConstants
[
"SQRT2"
]
=
F_SQRT2
;
mConstants
[
"SQRT3"
]
=
F_SQRT3
;
mConstants
[
"DEG_TO_RAD"
]
=
DEG_TO_RAD
;
mConstants
[
"RAD_TO_DEG"
]
=
RAD_TO_DEG
;
mConstants
[
"GRAVITY"
]
=
GRAVITY
;
}
LLCalc
::~
LLCalc
()
{
delete
mConstants
;
delete
mVariables
;
// delete mUserVariables;
}
//static
...
...
@@ -93,17 +86,17 @@ LLCalc* LLCalc::getInstance()
void
LLCalc
::
setVar
(
const
std
::
string
&
name
,
const
F32
&
value
)
{
(
*
mVariables
)
[
name
]
=
value
;
mVariables
[
name
]
=
value
;
}
void
LLCalc
::
clearVar
(
const
std
::
string
&
name
)
{
mVariables
->
erase
(
name
);
mVariables
.
erase
(
name
);
}
void
LLCalc
::
clearAllVariables
()
{
mVariables
->
clear
();
mVariables
.
clear
();
}
/*
...
...
@@ -122,7 +115,7 @@ bool LLCalc::evalString(const std::string& expression, F32& result)
std
::
string
expr_upper
=
expression
;
LLStringUtil
::
toUpper
(
expr_upper
);
LLCalcParser
calc
(
result
,
mConstants
,
mVariables
);
LLCalcParser
calc
(
result
,
&
mConstants
,
&
mVariables
);
mLastErrorPos
=
0
;
std
::
string
::
iterator
start
=
expr_upper
.
begin
();
...
...
This diff is collapsed.
Click to expand it.
indra/llmath/llcalc.h
+
3
−
3
View file @
57c30517
...
...
@@ -69,12 +69,12 @@ class LLCalc
private
:
std
::
string
::
size_type
mLastErrorPos
;
calc_map_t
*
mConstants
;
calc_map_t
*
mVariables
;
calc_map_t
mConstants
;
calc_map_t
mVariables
;
// *TODO: Add support for storing user defined variables, and stored functions.
// Will need UI work, and a means to save them between sessions.
// calc_map_t
*
mUserVariables;
// calc_map_t mUserVariables;
// "There shall be only one"
static
LLCalc
*
sInstance
;
...
...
This diff is collapsed.
Click to expand it.
indra/llui/llspinctrl.cpp
+
1
−
9
View file @
57c30517
...
...
@@ -124,15 +124,7 @@ LLSpinCtrl::LLSpinCtrl(const LLSpinCtrl::Params& p)
params
.
max_length
.
bytes
(
MAX_STRING_LENGTH
);
params
.
commit_callback
.
function
((
boost
::
bind
(
&
LLSpinCtrl
::
onEditorCommit
,
this
,
_2
)));
//allow entering of any chars for LLCalc, proper input will be evaluated on commit
//if( mPrecision>0 )//should accept float numbers
//{
// params.prevalidate_callback(&LLTextValidate::validateFloat);
//}
//else //should accept int numbers
//{
// params.prevalidate_callback(&LLTextValidate::validateInt);
//}
//*NOTE: allow entering of any chars for LLCalc, proper input will be evaluated on commit
params
.
follows
.
flags
(
FOLLOWS_LEFT
|
FOLLOWS_BOTTOM
);
mEditor
=
LLUICtrlFactory
::
create
<
LLLineEditor
>
(
params
);
...
...
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