aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llmessage/llnamevalue.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:46 -0500
committerJacek Antonelli2008-08-15 23:44:46 -0500
commit38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch)
treeadca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/llmessage/llnamevalue.cpp
parentREADME.txt (diff)
downloadmeta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz
Second Life viewer sources 1.13.2.12
Diffstat (limited to 'linden/indra/llmessage/llnamevalue.cpp')
-rw-r--r--linden/indra/llmessage/llnamevalue.cpp2160
1 files changed, 2160 insertions, 0 deletions
diff --git a/linden/indra/llmessage/llnamevalue.cpp b/linden/indra/llmessage/llnamevalue.cpp
new file mode 100644
index 0000000..0b4f0b6
--- /dev/null
+++ b/linden/indra/llmessage/llnamevalue.cpp
@@ -0,0 +1,2160 @@
1/**
2 * @file llnamevalue.cpp
3 * @brief class for defining name value pairs.
4 *
5 * Copyright (c) 2001-2007, Linden Research, Inc.
6 *
7 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement
10 * ("Other License"), formally executed by you and Linden Lab. Terms of
11 * the GPL can be found in doc/GPL-license.txt in this distribution, or
12 * online at http://secondlife.com/developers/opensource/gplv2
13 *
14 * There are special exceptions to the terms and conditions of the GPL as
15 * it is applied to this Source Code. View the full text of the exception
16 * in the file doc/FLOSS-exception.txt in this software distribution, or
17 * online at http://secondlife.com/developers/opensource/flossexception
18 *
19 * By copying, modifying or distributing this software, you acknowledge
20 * that you have read and understood your obligations described above,
21 * and agree to abide by those obligations.
22 *
23 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
24 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
25 * COMPLETENESS OR PERFORMANCE.
26 */
27
28// Examples:
29// AvatarCharacter STRING RW DSV male1
30
31#include "linden_common.h"
32
33#include <map>
34
35#include "llnamevalue.h"
36#include "u64.h"
37#include "llstring.h"
38#include "llcamera.h"
39
40// Anonymous enumeration to provide constants in this file.
41// *NOTE: These values may be used in sscanf statements below as their
42// value-1, so search for '2047' if you cange NV_BUFFER_LEN or '63' if
43// you change U64_BUFFER_LEN.
44enum
45{
46 NV_BUFFER_LEN = 2048,
47 U64_BUFFER_LEN = 64
48};
49
50struct user_callback_t
51{
52 user_callback_t() {};
53 user_callback_t(TNameValueCallback cb, void** data) : m_Callback(cb), m_Data(data) {}
54 TNameValueCallback m_Callback;
55 void ** m_Data;
56};
57typedef std::map<char *, user_callback_t> user_callback_map_t;
58user_callback_map_t gUserCallbackMap;
59
60LLStringTable gNVNameTable(16384);
61
62char NameValueTypeStrings[NVT_EOF][NAME_VALUE_TYPE_STRING_LENGTH] =
63{
64 "NULL",
65 "STRING",
66 "F32",
67 "S32",
68 "VEC3",
69 "U32",
70 "CAMERA", // Deprecated, but leaving in case removing completely would cause problems
71 "ASSET",
72 "U64"
73}; /*Flawfinder: Ignore*/
74
75char NameValueClassStrings[NVC_EOF][NAME_VALUE_CLASS_STRING_LENGTH] =
76{
77 "NULL",
78 "R", // read only
79 "RW", // read write
80 "CB" // callback
81}; /*Flawfinder: Ignore*/
82
83char NameValueSendtoStrings[NVS_EOF][NAME_VALUE_SENDTO_STRING_LENGTH] =
84{
85 "NULL",
86 "S", // "Sim", formerly SIM
87 "DS", // "Data Sim" formerly SIM_SPACE
88 "SV", // "Sim Viewer" formerly SIM_VIEWER
89 "DSV" // "Data Sim Viewer", formerly SIM_SPACE_VIEWER
90}; /*Flawfinder: Ignore*/
91
92
93void add_use_callback(char *name, TNameValueCallback ucb, void **user_data)
94{
95 char *temp = gNVNameTable.addString(name);
96 gUserCallbackMap[temp] = user_callback_t(ucb,user_data);
97}
98
99
100//
101// Class
102//
103
104LLNameValue::LLNameValue()
105{
106 baseInit();
107}
108
109void LLNameValue::baseInit()
110{
111 mNVNameTable = &gNVNameTable;
112
113 mName = NULL;
114 mNameValueReference.string = NULL;
115
116 mType = NVT_NULL;
117 mStringType = NameValueTypeStrings[NVT_NULL];
118
119 mClass = NVC_NULL;
120 mStringClass = NameValueClassStrings[NVC_NULL];
121
122 mSendto = NVS_NULL;
123 mStringSendto = NameValueSendtoStrings[NVS_NULL];
124}
125
126void LLNameValue::init(const char *name, const char *data, const char *type, const char *nvclass, const char *nvsendto, TNameValueCallback nvcb, void **user_data)
127{
128 mNVNameTable = &gNVNameTable;
129
130 mName = mNVNameTable->addString(name);
131
132 // Nota Bene: Whatever global structure manages this should have these in the name table already!
133 mStringType = mNVNameTable->addString(type);
134 if (!strcmp(mStringType, "STRING"))
135 {
136 S32 string_length = (S32)strlen(data); /*Flawfinder: Ignore*/
137 mType = NVT_STRING;
138
139 delete[] mNameValueReference.string;
140
141 // two options here. . . data can either look like foo or "foo"
142 // WRONG! - this is a poorly implemented and incomplete escape
143 // mechanism. For example, using this scheme, there is no way
144 // to tell an intentional double quotes from a zero length
145 // string. This needs to excised. Phoenix
146 //if (strchr(data, '\"'))
147 //{
148 // string_length -= 2;
149 // mNameValueReference.string = new char[string_length + 1];;
150 // strncpy(mNameValueReference.string, data + 1, string_length);
151 //}
152 //else
153 //{
154 mNameValueReference.string = new char[string_length + 1];;
155 strncpy(mNameValueReference.string, data, string_length); /*Flawfinder: Ignore*/
156 //}
157 mNameValueReference.string[string_length] = 0;
158 }
159 else if (!strcmp(mStringType, "F32"))
160 {
161 mType = NVT_F32;
162 mNameValueReference.f32 = new F32((F32)atof(data));
163 }
164 else if (!strcmp(mStringType, "S32"))
165 {
166 mType = NVT_S32;
167 mNameValueReference.s32 = new S32(atoi(data));
168 }
169 else if (!strcmp(mStringType, "U64"))
170 {
171 mType = NVT_U64;
172 mNameValueReference.u64 = new U64(str_to_U64(data));
173 }
174 else if (!strcmp(mStringType, "VEC3"))
175 {
176 mType = NVT_VEC3;
177 F32 t1, t2, t3;
178
179 // two options here. . . data can either look like 0, 1, 2 or <0, 1, 2>
180
181 if (strchr(data, '<'))
182 {
183 sscanf(data, "<%f, %f, %f>", &t1, &t2, &t3);
184 }
185 else
186 {
187 sscanf(data, "%f, %f, %f", &t1, &t2, &t3);
188 }
189
190 // finite checks
191 if (!llfinite(t1) || !llfinite(t2) || !llfinite(t3))
192 {
193 t1 = 0.f;
194 t2 = 0.f;
195 t3 = 0.f;
196 }
197
198 mNameValueReference.vec3 = new LLVector3(t1, t2, t3);
199 }
200 else if (!strcmp(mStringType, "U32"))
201 {
202 mType = NVT_U32;
203 mNameValueReference.u32 = new U32(atoi(data));
204 }
205 else if(!strcmp(mStringType, (const char*)NameValueTypeStrings[NVT_ASSET]))
206 {
207 // assets are treated like strings, except that the name has
208 // meaning to an LLAssetInfo object
209 S32 string_length = (S32)strlen(data); /*Flawfinder: Ignore*/
210 mType = NVT_ASSET;
211
212 // two options here. . . data can either look like foo or "foo"
213 // WRONG! - this is a poorly implemented and incomplete escape
214 // mechanism. For example, using this scheme, there is no way
215 // to tell an intentional double quotes from a zero length
216 // string. This needs to excised. Phoenix
217 //if (strchr(data, '\"'))
218 //{
219 // string_length -= 2;
220 // mNameValueReference.string = new char[string_length + 1];;
221 // strncpy(mNameValueReference.string, data + 1, string_length);
222 //}
223 //else
224 //{
225 mNameValueReference.string = new char[string_length + 1];;
226 strncpy(mNameValueReference.string, data, string_length); /*Flawfinder: Ignore*/
227 //}
228 mNameValueReference.string[string_length] = 0;
229 }
230 else
231 {
232 llwarns << "Unknown name value type string " << mStringType << " for " << mName << llendl;
233 mType = NVT_NULL;
234 }
235
236
237 // Nota Bene: Whatever global structure manages this should have these in the name table already!
238 if (!strcmp(nvclass, "R") ||
239 !strcmp(nvclass, "READ_ONLY")) // legacy
240 {
241 mClass = NVC_READ_ONLY;
242 mStringClass = mNVNameTable->addString("R");
243 }
244 else if (!strcmp(nvclass, "RW") ||
245 !strcmp(nvclass, "READ_WRITE")) // legacy
246 {
247 mClass = NVC_READ_WRITE;
248 mStringClass = mNVNameTable->addString("RW");
249 }
250 else if (!strcmp(nvclass, "CB") ||
251 !strcmp(nvclass, "CALLBACK")) // legacy
252 {
253 mClass = NVC_CALLBACK;
254 mStringClass = mNVNameTable->addString("CB");
255 mNameValueCB = nvcb;
256 mUserData = user_data;
257 }
258 else
259 {
260 // assume it's bad
261 mClass = NVC_NULL;
262 mStringClass = mNVNameTable->addString(nvclass);
263 mNameValueCB = NULL;
264 mUserData = NULL;
265
266 // are we a user-defined call back?
267 for (user_callback_map_t::iterator iter = gUserCallbackMap.begin();
268 iter != gUserCallbackMap.end(); iter++)
269 {
270 char* tname = iter->first;
271 if (tname == mStringClass)
272 {
273 mClass = NVC_CALLBACK;
274 mNameValueCB = (iter->second).m_Callback;
275 mUserData = (iter->second).m_Data;
276 }
277 }
278
279 // Warn if we didn't find a callback
280 if (mClass == NVC_NULL)
281 {
282 llwarns << "Unknown user callback in name value init() for " << mName << llendl;
283 }
284 }
285
286 // Initialize the sendto variable
287 if (!strcmp(nvsendto, "S") ||
288 !strcmp(nvsendto, "SIM")) // legacy
289 {
290 mSendto = NVS_SIM;
291 mStringSendto = mNVNameTable->addString("S");
292 }
293 else if (!strcmp(nvsendto, "DS") ||
294 !strcmp(nvsendto, "SIM_SPACE")) // legacy
295 {
296 mSendto = NVS_DATA_SIM;
297 mStringSendto = mNVNameTable->addString("DS");
298 }
299 else if (!strcmp(nvsendto, "SV") ||
300 !strcmp(nvsendto, "SIM_VIEWER")) // legacy
301 {
302 mSendto = NVS_SIM_VIEWER;
303 mStringSendto = mNVNameTable->addString("SV");
304 }
305 else if (!strcmp(nvsendto, "DSV") ||
306 !strcmp(nvsendto, "SIM_SPACE_VIEWER")) // legacy
307 {
308 mSendto = NVS_DATA_SIM_VIEWER;
309 mStringSendto = mNVNameTable->addString("DSV");
310 }
311 else
312 {
313 llwarns << "LLNameValue::init() - unknown sendto field "
314 << nvsendto << " for NV " << mName << llendl;
315 mSendto = NVS_NULL;
316 mStringSendto = mNVNameTable->addString("S");
317 }
318
319}
320
321
322LLNameValue::LLNameValue(const char *name, const char *data, const char *type, const char *nvclass, TNameValueCallback nvcb, void **user_data)
323{
324 baseInit();
325 // if not specified, send to simulator only
326 init(name, data, type, nvclass, "SIM", nvcb, user_data);
327}
328
329
330LLNameValue::LLNameValue(const char *name, const char *data, const char *type, const char *nvclass, const char *nvsendto, TNameValueCallback nvcb, void **user_data)
331{
332 baseInit();
333 init(name, data, type, nvclass, nvsendto, nvcb, user_data);
334}
335
336
337
338// Initialize without any initial data.
339LLNameValue::LLNameValue(const char *name, const char *type, const char *nvclass, TNameValueCallback nvcb, void **user_data)
340{
341 baseInit();
342 mName = mNVNameTable->addString(name);
343
344 // Nota Bene: Whatever global structure manages this should have these in the name table already!
345 mStringType = mNVNameTable->addString(type);
346 if (!strcmp(mStringType, "STRING"))
347 {
348 mType = NVT_STRING;
349 mNameValueReference.string = NULL;
350 }
351 else if (!strcmp(mStringType, "F32"))
352 {
353 mType = NVT_F32;
354 mNameValueReference.f32 = NULL;
355 }
356 else if (!strcmp(mStringType, "S32"))
357 {
358 mType = NVT_S32;
359 mNameValueReference.s32 = NULL;
360 }
361 else if (!strcmp(mStringType, "VEC3"))
362 {
363 mType = NVT_VEC3;
364 mNameValueReference.vec3 = NULL;
365 }
366 else if (!strcmp(mStringType, "U32"))
367 {
368 mType = NVT_U32;
369 mNameValueReference.u32 = NULL;
370 }
371 else if (!strcmp(mStringType, "U64"))
372 {
373 mType = NVT_U64;
374 mNameValueReference.u64 = NULL;
375 }
376 else if(!strcmp(mStringType, (const char*)NameValueTypeStrings[NVT_ASSET]))
377 {
378 mType = NVT_ASSET;
379 mNameValueReference.string = NULL;
380 }
381 else
382 {
383 mType = NVT_NULL;
384 llinfos << "Unknown name-value type " << mStringType << llendl;
385 }
386
387 // Nota Bene: Whatever global structure manages this should have these in the name table already!
388 mStringClass = mNVNameTable->addString(nvclass);
389 if (!strcmp(mStringClass, "READ_ONLY"))
390 {
391 mClass = NVC_READ_ONLY;
392 }
393 else if (!strcmp(mStringClass, "READ_WRITE"))
394 {
395 mClass = NVC_READ_WRITE;
396 }
397 else if (!strcmp(mStringClass, "CALLBACK"))
398 {
399 mClass = NVC_READ_WRITE;
400 mNameValueCB = nvcb;
401 mUserData = user_data;
402 }
403
404 // Initialize the sendto variable
405 mStringSendto = mNVNameTable->addString("SIM");
406 mSendto = NVS_SIM;
407}
408
409
410// data is in the format:
411// "NameValueName Type Class Data"
412LLNameValue::LLNameValue(const char *data)
413{
414 baseInit();
415 static char name[NV_BUFFER_LEN];
416 static char type[NV_BUFFER_LEN];
417 static char nvclass[NV_BUFFER_LEN];
418 static char nvsendto[NV_BUFFER_LEN];
419 static char nvdata[NV_BUFFER_LEN];
420
421 S32 i;
422
423 S32 character_count = 0;
424 S32 length = 0;
425
426 // go to first non-whitespace character
427 while (1)
428 {
429 if ( (*(data + character_count) == ' ')
430 ||(*(data + character_count) == '\n')
431 ||(*(data + character_count) == '\t')
432 ||(*(data + character_count) == '\r'))
433 {
434 character_count++;
435 }
436 else
437 {
438 break;
439 }
440 }
441
442 // read in the name
443 sscanf((data + character_count), "%2047s", name);
444
445 // bump past it and add null terminator
446 length = (S32)strlen(name); /* Flawfinder: ignore */
447 name[length] = 0;
448 character_count += length;
449
450 // go to the next non-whitespace character
451 while (1)
452 {
453 if ( (*(data + character_count) == ' ')
454 ||(*(data + character_count) == '\n')
455 ||(*(data + character_count) == '\t')
456 ||(*(data + character_count) == '\r'))
457 {
458 character_count++;
459 }
460 else
461 {
462 break;
463 }
464 }
465
466 // read in the type
467 sscanf((data + character_count), "%2047s", type);
468
469 // bump past it and add null terminator
470 length = (S32)strlen(type); /* Flawfinder: ignore */
471 type[length] = 0;
472 character_count += length;
473
474 // go to the next non-whitespace character
475 while (1)
476 {
477 if ( (*(data + character_count) == ' ')
478 ||(*(data + character_count) == '\n')
479 ||(*(data + character_count) == '\t')
480 ||(*(data + character_count) == '\r'))
481 {
482 character_count++;
483 }
484 else
485 {
486 break;
487 }
488 }
489
490 // do we have a type argument?
491 for (i = NVC_READ_ONLY; i < NVC_EOF; i++)
492 {
493 if (!strncmp(NameValueClassStrings[i], data + character_count, strlen(NameValueClassStrings[i]))) /* Flawfinder: ignore */
494 {
495 break;
496 }
497 }
498
499 if (i != NVC_EOF)
500 {
501 // yes we do!
502 // read in the class
503 sscanf((data + character_count), "%2047s", nvclass);
504
505 // bump past it and add null terminator
506 length = (S32)strlen(nvclass); /* Flawfinder: ignore */
507 nvclass[length] = 0;
508 character_count += length;
509
510 // go to the next non-whitespace character
511 while (1)
512 {
513 if ( (*(data + character_count) == ' ')
514 ||(*(data + character_count) == '\n')
515 ||(*(data + character_count) == '\t')
516 ||(*(data + character_count) == '\r'))
517 {
518 character_count++;
519 }
520 else
521 {
522 break;
523 }
524 }
525 }
526 else
527 {
528 // no type argument given, default to read-write
529 strncpy(nvclass, "READ_WRITE", sizeof(nvclass) -1); /* Flawfinder: ignore */
530 nvclass[sizeof(nvclass) -1] = '\0';
531 }
532
533 // Do we have a sendto argument?
534 for (i = NVS_SIM; i < NVS_EOF; i++)
535 {
536 if (!strncmp(NameValueSendtoStrings[i], data + character_count, strlen(NameValueSendtoStrings[i]))) /* Flawfinder: ignore */
537 {
538 break;
539 }
540 }
541
542 if (i != NVS_EOF)
543 {
544 // found a sendto argument
545 sscanf((data + character_count), "%2047s", nvsendto);
546
547 // add null terminator
548 length = (S32)strlen(nvsendto); /* Flawfinder: ignore */
549 nvsendto[length] = 0;
550 character_count += length;
551
552 // seek to next non-whitespace characer
553 while (1)
554 {
555 if ( (*(data + character_count) == ' ')
556 ||(*(data + character_count) == '\n')
557 ||(*(data + character_count) == '\t')
558 ||(*(data + character_count) == '\r'))
559 {
560 character_count++;
561 }
562 else
563 {
564 break;
565 }
566 }
567 }
568 else
569 {
570 // no sendto argument given, default to sim only
571 strncpy(nvsendto, "SIM", sizeof(nvsendto) -1); /* Flawfinder: ignore */
572 nvsendto[sizeof(nvsendto) -1] ='\0';
573 }
574
575
576 // copy the rest character by character into data
577 length = 0;
578
579 while ( (*(nvdata + length++) = *(data + character_count++)) )
580 ;
581
582 init(name, nvdata, type, nvclass, nvsendto);
583}
584
585
586LLNameValue::~LLNameValue()
587{
588 mNVNameTable->removeString(mName);
589 mName = NULL;
590
591 switch(mType)
592 {
593 case NVT_STRING:
594 case NVT_ASSET:
595 delete [] mNameValueReference.string;
596 mNameValueReference.string = NULL;
597 break;
598 case NVT_F32:
599 delete mNameValueReference.f32;
600 mNameValueReference.string = NULL;
601 break;
602 case NVT_S32:
603 delete mNameValueReference.s32;
604 mNameValueReference.string = NULL;
605 break;
606 case NVT_VEC3:
607 delete mNameValueReference.vec3;
608 mNameValueReference.string = NULL;
609 break;
610 case NVT_U32:
611 delete mNameValueReference.u32;
612 mNameValueReference.u32 = NULL;
613 break;
614 case NVT_U64:
615 delete mNameValueReference.u64;
616 mNameValueReference.u64 = NULL;
617 break;
618 default:
619 break;
620 }
621
622 delete[] mNameValueReference.string;
623 mNameValueReference.string = NULL;
624}
625
626char *LLNameValue::getString()
627{
628 if (mType == NVT_STRING)
629 {
630 return mNameValueReference.string;
631 }
632 else
633 {
634 llerrs << mName << " not a string!" << llendl;
635 return NULL;
636 }
637}
638
639const char *LLNameValue::getAsset() const
640{
641 if (mType == NVT_ASSET)
642 {
643 return mNameValueReference.string;
644 }
645 else
646 {
647 llerrs << mName << " not an asset!" << llendl;
648 return NULL;
649 }
650}
651
652F32 *LLNameValue::getF32()
653{
654 if (mType == NVT_F32)
655 {
656 return mNameValueReference.f32;
657 }
658 else
659 {
660 llerrs << mName << " not a F32!" << llendl;
661 return NULL;
662 }
663}
664
665S32 *LLNameValue::getS32()
666{
667 if (mType == NVT_S32)
668 {
669 return mNameValueReference.s32;
670 }
671 else
672 {
673 llerrs << mName << " not a S32!" << llendl;
674 return NULL;
675 }
676}
677
678U32 *LLNameValue::getU32()
679{
680 if (mType == NVT_U32)
681 {
682 return mNameValueReference.u32;
683 }
684 else
685 {
686 llerrs << mName << " not a U32!" << llendl;
687 return NULL;
688 }
689}
690
691U64 *LLNameValue::getU64()
692{
693 if (mType == NVT_U64)
694 {
695 return mNameValueReference.u64;
696 }
697 else
698 {
699 llerrs << mName << " not a U64!" << llendl;
700 return NULL;
701 }
702}
703
704void LLNameValue::getVec3(LLVector3 &vec)
705{
706 if (mType == NVT_VEC3)
707 {
708 vec = *mNameValueReference.vec3;
709 }
710 else
711 {
712 llerrs << mName << " not a Vec3!" << llendl;
713 }
714}
715
716LLVector3 *LLNameValue::getVec3()
717{
718 if (mType == NVT_VEC3)
719 {
720 return (mNameValueReference.vec3);
721 }
722 else
723 {
724 llerrs << mName << " not a Vec3!" << llendl;
725 return NULL;
726 }
727}
728
729
730F32 LLNameValue::magnitude()
731{
732 switch(mType)
733 {
734 case NVT_STRING:
735 return (F32)(strlen(mNameValueReference.string)); /* Flawfinder: ignore */
736 break;
737 case NVT_F32:
738 return (fabsf(*mNameValueReference.f32));
739 break;
740 case NVT_S32:
741 return (fabsf((F32)(*mNameValueReference.s32)));
742 break;
743 case NVT_VEC3:
744 return (mNameValueReference.vec3->magVec());
745 break;
746 case NVT_U32:
747 return (F32)(*mNameValueReference.u32);
748 break;
749 default:
750 llerrs << "No magnitude operation for NV type " << mStringType << llendl;
751 break;
752 }
753 return 0.f;
754}
755
756
757void LLNameValue::callCallback()
758{
759 if (mNameValueCB)
760 {
761 (*mNameValueCB)(this, mUserData);
762 }
763 else
764 {
765 llinfos << mName << " has no callback!" << llendl;
766 }
767}
768
769
770BOOL LLNameValue::sendToData() const
771{
772 return (mSendto == NVS_DATA_SIM || mSendto == NVS_DATA_SIM_VIEWER);
773}
774
775
776BOOL LLNameValue::sendToViewer() const
777{
778 return (mSendto == NVS_SIM_VIEWER || mSendto == NVS_DATA_SIM_VIEWER);
779}
780
781
782LLNameValue &LLNameValue::operator=(const LLNameValue &a)
783{
784 if (mType != a.mType)
785 {
786 return *this;
787 }
788 if (mClass == NVC_READ_ONLY)
789 return *this;
790
791 BOOL b_changed = FALSE;
792 if ( (mClass == NVC_CALLBACK)
793 &&(*this != a))
794 {
795 b_changed = TRUE;
796 }
797
798 switch(a.mType)
799 {
800 case NVT_STRING:
801 case NVT_ASSET:
802 if (mNameValueReference.string)
803 delete [] mNameValueReference.string;
804
805 mNameValueReference.string = new char [strlen(a.mNameValueReference.string) + 1]; /* Flawfinder: ignore */
806 if(mNameValueReference.string != NULL)
807 {
808 strcpy(mNameValueReference.string, a.mNameValueReference.string); /* Flawfinder: ignore */
809 }
810 break;
811 case NVT_F32:
812 *mNameValueReference.f32 = *a.mNameValueReference.f32;
813 break;
814 case NVT_S32:
815 *mNameValueReference.s32 = *a.mNameValueReference.s32;
816 break;
817 case NVT_VEC3:
818 *mNameValueReference.vec3 = *a.mNameValueReference.vec3;
819 break;
820 case NVT_U32:
821 *mNameValueReference.u32 = *a.mNameValueReference.u32;
822 break;
823 case NVT_U64:
824 *mNameValueReference.u64 = *a.mNameValueReference.u64;
825 break;
826 default:
827 llerrs << "Unknown Name value type " << (U32)a.mType << llendl;
828 break;
829 }
830
831 if (b_changed)
832 {
833 callCallback();
834 }
835
836 return *this;
837}
838
839void LLNameValue::setString(const char *a)
840{
841 if (mClass == NVC_READ_ONLY)
842 return;
843 BOOL b_changed = FALSE;
844
845 switch(mType)
846 {
847 case NVT_STRING:
848 if (a)
849 {
850 if ( (mClass == NVC_CALLBACK)
851 &&(strcmp(this->mNameValueReference.string,a)))
852 {
853 b_changed = TRUE;
854 }
855
856 if (mNameValueReference.string)
857 {
858 delete [] mNameValueReference.string;
859 }
860
861 mNameValueReference.string = new char [strlen(a) + 1]; /* Flawfinder: ignore */
862 if(mNameValueReference.string != NULL)
863 {
864 strcpy(mNameValueReference.string, a); /* Flawfinder: ignore */
865 }
866
867 if (b_changed)
868 {
869 callCallback();
870 }
871 }
872 else
873 {
874 if (mNameValueReference.string)
875 delete [] mNameValueReference.string;
876
877 mNameValueReference.string = new char [1];
878 mNameValueReference.string[0] = 0;
879 }
880 break;
881 default:
882 break;
883 }
884
885 if (b_changed)
886 {
887 callCallback();
888 }
889
890 return;
891}
892
893
894void LLNameValue::setAsset(const char *a)
895{
896 if (mClass == NVC_READ_ONLY)
897 return;
898 BOOL b_changed = FALSE;
899
900 switch(mType)
901 {
902 case NVT_ASSET:
903 if (a)
904 {
905 if ( (mClass == NVC_CALLBACK)
906 &&(strcmp(this->mNameValueReference.string,a)))
907 {
908 b_changed = TRUE;
909 }
910
911 if (mNameValueReference.string)
912 {
913 delete [] mNameValueReference.string;
914 }
915 mNameValueReference.string = new char [strlen(a) + 1]; /* Flawfinder: ignore */
916 if(mNameValueReference.string != NULL)
917 {
918 strcpy(mNameValueReference.string, a); /* Flawfinder: ignore */
919 }
920
921 if (b_changed)
922 {
923 callCallback();
924 }
925 }
926 else
927 {
928 if (mNameValueReference.string)
929 delete [] mNameValueReference.string;
930
931 mNameValueReference.string = new char [1];
932 mNameValueReference.string[0] = 0;
933 }
934 break;
935 default:
936 break;
937 }
938 if (b_changed)
939 {
940 callCallback();
941 }
942}
943
944
945void LLNameValue::setF32(const F32 a)
946{
947 if (mClass == NVC_READ_ONLY)
948 return;
949 BOOL b_changed = FALSE;
950
951 switch(mType)
952 {
953 case NVT_F32:
954 if ( (mClass == NVC_CALLBACK)
955 &&(*this->mNameValueReference.f32 != a))
956 {
957 b_changed = TRUE;
958 }
959 *mNameValueReference.f32 = a;
960 if (b_changed)
961 {
962 callCallback();
963 }
964 break;
965 default:
966 break;
967 }
968 if (b_changed)
969 {
970 callCallback();
971 }
972
973 return;
974}
975
976
977void LLNameValue::setS32(const S32 a)
978{
979 if (mClass == NVC_READ_ONLY)
980 return;
981 BOOL b_changed = FALSE;
982
983 switch(mType)
984 {
985 case NVT_S32:
986 if ( (mClass == NVC_CALLBACK)
987 &&(*this->mNameValueReference.s32 != a))
988 {
989 b_changed = TRUE;
990 }
991 *mNameValueReference.s32 = a;
992 if (b_changed)
993 {
994 callCallback();
995 }
996 break;
997 case NVT_U32:
998 if ( (mClass == NVC_CALLBACK)
999 && ((S32) (*this->mNameValueReference.u32) != a))
1000 {
1001 b_changed = TRUE;
1002 }
1003 *mNameValueReference.u32 = a;
1004 if (b_changed)
1005 {
1006 callCallback();
1007 }
1008 break;
1009 case NVT_F32:
1010 if ( (mClass == NVC_CALLBACK)
1011 &&(*this->mNameValueReference.f32 != a))
1012 {
1013 b_changed = TRUE;
1014 }
1015 *mNameValueReference.f32 = (F32)a;
1016 if (b_changed)
1017 {
1018 callCallback();
1019 }
1020 break;
1021 default:
1022 break;
1023 }
1024 if (b_changed)
1025 {
1026 callCallback();
1027 }
1028
1029 return;
1030}
1031
1032
1033void LLNameValue::setU32(const U32 a)
1034{
1035 if (mClass == NVC_READ_ONLY)
1036 return;
1037 BOOL b_changed = FALSE;
1038
1039 switch(mType)
1040 {
1041 case NVT_S32:
1042 if ( (mClass == NVC_CALLBACK)
1043 &&(*this->mNameValueReference.s32 != (S32) a))
1044 {
1045 b_changed = TRUE;
1046 }
1047 *mNameValueReference.s32 = a;
1048 if (b_changed)
1049 {
1050 callCallback();
1051 }
1052 break;
1053 case NVT_U32:
1054 if ( (mClass == NVC_CALLBACK)
1055 &&(*this->mNameValueReference.u32 != a))
1056 {
1057 b_changed = TRUE;
1058 }
1059 *mNameValueReference.u32 = a;
1060 if (b_changed)
1061 {
1062 callCallback();
1063 }
1064 break;
1065 case NVT_F32:
1066 if ( (mClass == NVC_CALLBACK)
1067 &&(*this->mNameValueReference.f32 != a))
1068 {
1069 b_changed = TRUE;
1070 }
1071 *mNameValueReference.f32 = (F32)a;
1072 if (b_changed)
1073 {
1074 callCallback();
1075 }
1076 break;
1077 default:
1078 llerrs << "NameValue: Trying to set U32 into a " << mStringType << ", unknown conversion" << llendl;
1079 break;
1080 }
1081 return;
1082}
1083
1084
1085void LLNameValue::setVec3(const LLVector3 &a)
1086{
1087 if (mClass == NVC_READ_ONLY)
1088 return;
1089 BOOL b_changed = FALSE;
1090
1091 switch(mType)
1092 {
1093 case NVT_VEC3:
1094 if ( (mClass == NVC_CALLBACK)
1095 &&(*this->mNameValueReference.vec3 != a))
1096 {
1097 b_changed = TRUE;
1098 }
1099 *mNameValueReference.vec3 = a;
1100 if (b_changed)
1101 {
1102 callCallback();
1103 }
1104 break;
1105 default:
1106 llerrs << "NameValue: Trying to set LLVector3 into a " << mStringType << ", unknown conversion" << llendl;
1107 break;
1108 }
1109 return;
1110}
1111
1112
1113BOOL LLNameValue::nonzero()
1114{
1115 switch(mType)
1116 {
1117 case NVT_STRING:
1118 if (!mNameValueReference.string)
1119 return 0;
1120 return (mNameValueReference.string[0] != 0);
1121 case NVT_F32:
1122 return (*mNameValueReference.f32 != 0.f);
1123 case NVT_S32:
1124 return (*mNameValueReference.s32 != 0);
1125 case NVT_U32:
1126 return (*mNameValueReference.u32 != 0);
1127 case NVT_VEC3:
1128 return (mNameValueReference.vec3->magVecSquared() != 0.f);
1129 default:
1130 llerrs << "NameValue: Trying to call nonzero on a " << mStringType << ", unknown conversion" << llendl;
1131 break;
1132 }
1133 return FALSE;
1134}
1135
1136std::string LLNameValue::printNameValue()
1137{
1138 std::string buffer;
1139 buffer = llformat("%s %s %s %s ", mName, mStringType, mStringClass, mStringSendto);
1140 buffer += printData();
1141// llinfos << "Name Value Length: " << buffer.size() + 1 << llendl;
1142 return buffer;
1143}
1144
1145std::string LLNameValue::printData()
1146{
1147 std::string buffer;
1148 switch(mType)
1149 {
1150 case NVT_STRING:
1151 case NVT_ASSET:
1152 buffer = mNameValueReference.string;
1153 break;
1154 case NVT_F32:
1155 buffer = llformat("%f", *mNameValueReference.f32);
1156 break;
1157 case NVT_S32:
1158 buffer = llformat("%d", *mNameValueReference.s32);
1159 break;
1160 case NVT_U32:
1161 buffer = llformat("%u", *mNameValueReference.u32);
1162 break;
1163 case NVT_U64:
1164 {
1165 char u64_string[U64_BUFFER_LEN]; /* Flawfinder: ignore */
1166 U64_to_str(*mNameValueReference.u64, u64_string, sizeof(u64_string));
1167 buffer = u64_string;
1168 }
1169 break;
1170 case NVT_VEC3:
1171 buffer = llformat( "%f, %f, %f", mNameValueReference.vec3->mV[VX], mNameValueReference.vec3->mV[VY], mNameValueReference.vec3->mV[VZ]);
1172 break;
1173 default:
1174 llerrs << "Trying to print unknown NameValue type " << mStringType << llendl;
1175 break;
1176 }
1177 return buffer;
1178}
1179
1180std::ostream& operator<<(std::ostream& s, const LLNameValue &a)
1181{
1182 switch(a.mType)
1183 {
1184 case NVT_STRING:
1185 case NVT_ASSET:
1186 s << a.mNameValueReference.string;
1187 break;
1188 case NVT_F32:
1189 s << (*a.mNameValueReference.f32);
1190 break;
1191 case NVT_S32:
1192 s << *(a.mNameValueReference.s32);
1193 break;
1194 case NVT_U32:
1195 s << *(a.mNameValueReference.u32);
1196 break;
1197 case NVT_U64:
1198 {
1199 char u64_string[U64_BUFFER_LEN]; /* Flawfinder: ignore */
1200 U64_to_str(*a.mNameValueReference.u64, u64_string, sizeof(u64_string));
1201 s << u64_string;
1202 }
1203 case NVT_VEC3:
1204 s << *(a.mNameValueReference.vec3);
1205 break;
1206 default:
1207 llerrs << "Trying to print unknown NameValue type " << a.mStringType << llendl;
1208 break;
1209 }
1210 return s;
1211}
1212
1213
1214// nota bene: return values aren't static for now to prevent memory leaks
1215
1216LLNameValue &operator+(const LLNameValue &a, const LLNameValue &b)
1217{
1218 static LLNameValue retval;
1219
1220 switch(a.mType)
1221 {
1222 case NVT_STRING:
1223 if (b.mType == NVT_STRING)
1224 {
1225 retval.mType = a.mType;
1226 retval.mStringType = NameValueTypeStrings[a.mType];
1227
1228 S32 length1 = (S32)strlen(a.mNameValueReference.string); /* Flawfinder: Ignore */
1229 S32 length2 = (S32)strlen(b.mNameValueReference.string); /* Flawfinder: Ignore */
1230 delete [] retval.mNameValueReference.string;
1231 retval.mNameValueReference.string = new char[length1 + length2 + 1];
1232 if(retval.mNameValueReference.string != NULL)
1233 {
1234 strcpy(retval.mNameValueReference.string, a.mNameValueReference.string); /* Flawfinder: Ignore */
1235 strcat(retval.mNameValueReference.string, b.mNameValueReference.string); /* Flawfinder: Ignore */
1236 }
1237 }
1238 break;
1239 case NVT_F32:
1240 if (b.mType == NVT_F32)
1241 {
1242 retval.mType = NVT_F32;
1243 retval.mStringType = NameValueTypeStrings[NVT_F32];
1244 delete retval.mNameValueReference.f32;
1245 retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.f32 + *b.mNameValueReference.f32);
1246 }
1247 else if (b.mType == NVT_S32)
1248 {
1249 retval.mType = NVT_F32;
1250 retval.mStringType = NameValueTypeStrings[NVT_F32];
1251 delete retval.mNameValueReference.f32;
1252 retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.f32 + *b.mNameValueReference.s32);
1253 }
1254 else if (b.mType == NVT_U32)
1255 {
1256 retval.mType = NVT_F32;
1257 retval.mStringType = NameValueTypeStrings[NVT_F32];
1258 delete retval.mNameValueReference.f32;
1259 retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.f32 + *b.mNameValueReference.u32);
1260 }
1261 break;
1262 case NVT_S32:
1263 if (b.mType == NVT_F32)
1264 {
1265 retval.mType = NVT_F32;
1266 retval.mStringType = NameValueTypeStrings[NVT_F32];
1267 delete retval.mNameValueReference.f32;
1268 retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.s32 + *b.mNameValueReference.f32);
1269 }
1270 else if (b.mType == NVT_S32)
1271 {
1272 retval.mType = NVT_S32;
1273 retval.mStringType = NameValueTypeStrings[NVT_S32];
1274 delete retval.mNameValueReference.s32;
1275 retval.mNameValueReference.s32 = new S32(*a.mNameValueReference.s32 + *b.mNameValueReference.s32);
1276 }
1277 else if (b.mType == NVT_U32)
1278 {
1279 retval.mType = NVT_S32;
1280 retval.mStringType = NameValueTypeStrings[NVT_S32];
1281 delete retval.mNameValueReference.s32;
1282 retval.mNameValueReference.s32 = new S32(*a.mNameValueReference.s32 + *b.mNameValueReference.u32);
1283 }
1284 break;
1285 case NVT_U32:
1286 if (b.mType == NVT_F32)
1287 {
1288 retval.mType = NVT_F32;
1289 retval.mStringType = NameValueTypeStrings[NVT_F32];
1290 delete retval.mNameValueReference.f32;
1291 retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.u32 + *b.mNameValueReference.f32);
1292 }
1293 else if (b.mType == NVT_S32)
1294 {
1295 retval.mType = NVT_S32;
1296 retval.mStringType = NameValueTypeStrings[NVT_S32];
1297 delete retval.mNameValueReference.s32;
1298 retval.mNameValueReference.s32 = new S32(*a.mNameValueReference.u32 + *b.mNameValueReference.s32);
1299 }
1300 else if (b.mType == NVT_U32)
1301 {
1302 retval.mType = NVT_U32;
1303 retval.mStringType = NameValueTypeStrings[NVT_U32];
1304 delete retval.mNameValueReference.u32;
1305 retval.mNameValueReference.u32 = new U32(*a.mNameValueReference.u32 + *b.mNameValueReference.u32);
1306 }
1307 break;
1308 case NVT_VEC3:
1309 if ( (a.mType == b.mType)
1310 &&(a.mType == NVT_VEC3))
1311 {
1312 retval.mType = a.mType;
1313 retval.mStringType = NameValueTypeStrings[a.mType];
1314 delete retval.mNameValueReference.vec3;
1315 retval.mNameValueReference.vec3 = new LLVector3(*a.mNameValueReference.vec3 + *b.mNameValueReference.vec3);
1316 }
1317 break;
1318 default:
1319 llerrs << "Unknown add of NV type " << a.mStringType << " to " << b.mStringType << llendl;
1320 break;
1321 }
1322 return retval;
1323}
1324
1325LLNameValue &operator-(const LLNameValue &a, const LLNameValue &b)
1326{
1327 static LLNameValue retval;
1328
1329 switch(a.mType)
1330 {
1331 case NVT_STRING:
1332 break;
1333 case NVT_F32:
1334 if (b.mType == NVT_F32)
1335 {
1336 retval.mType = NVT_F32;
1337 retval.mStringType = NameValueTypeStrings[NVT_F32];
1338 delete retval.mNameValueReference.f32;
1339 retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.f32 - *b.mNameValueReference.f32);
1340 }
1341 else if (b.mType == NVT_S32)
1342 {
1343 retval.mType = NVT_F32;
1344 retval.mStringType = NameValueTypeStrings[NVT_F32];
1345 delete retval.mNameValueReference.f32;
1346 retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.f32 - *b.mNameValueReference.s32);
1347 }
1348 else if (b.mType == NVT_U32)
1349 {
1350 retval.mType = NVT_F32;
1351 retval.mStringType = NameValueTypeStrings[NVT_F32];
1352 delete retval.mNameValueReference.f32;
1353 retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.f32 - *b.mNameValueReference.u32);
1354 }
1355 break;
1356 case NVT_S32:
1357 if (b.mType == NVT_F32)
1358 {
1359 retval.mType = NVT_F32;
1360 retval.mStringType = NameValueTypeStrings[NVT_F32];
1361 delete retval.mNameValueReference.f32;
1362 retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.s32 - *b.mNameValueReference.f32);
1363 }
1364 else if (b.mType == NVT_S32)
1365 {
1366 retval.mType = NVT_S32;
1367 retval.mStringType = NameValueTypeStrings[NVT_S32];
1368 delete retval.mNameValueReference.s32;
1369 retval.mNameValueReference.s32 = new S32(*a.mNameValueReference.s32 - *b.mNameValueReference.s32);
1370 }
1371 else if (b.mType == NVT_U32)
1372 {
1373 retval.mType = NVT_S32;
1374 retval.mStringType = NameValueTypeStrings[NVT_S32];
1375 delete retval.mNameValueReference.s32;
1376 retval.mNameValueReference.s32 = new S32(*a.mNameValueReference.s32 - *b.mNameValueReference.u32);
1377 }
1378 break;
1379 case NVT_U32:
1380 if (b.mType == NVT_F32)
1381 {
1382 retval.mType = NVT_F32;
1383 retval.mStringType = NameValueTypeStrings[NVT_F32];
1384 delete retval.mNameValueReference.f32;
1385 retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.u32 - *b.mNameValueReference.f32);
1386 }
1387 else if (b.mType == NVT_S32)
1388 {
1389 retval.mType = NVT_S32;
1390 retval.mStringType = NameValueTypeStrings[NVT_S32];
1391 delete retval.mNameValueReference.s32;
1392 retval.mNameValueReference.s32 = new S32(*a.mNameValueReference.u32 - *b.mNameValueReference.s32);
1393 }
1394 else if (b.mType == NVT_U32)
1395 {
1396 retval.mType = NVT_U32;
1397 retval.mStringType = NameValueTypeStrings[NVT_U32];
1398 delete retval.mNameValueReference.u32;
1399 retval.mNameValueReference.u32 = new U32(*a.mNameValueReference.u32 - *b.mNameValueReference.u32);
1400 }
1401 break;
1402 case NVT_VEC3:
1403 if ( (a.mType == b.mType)
1404 &&(a.mType == NVT_VEC3))
1405 {
1406 retval.mType = a.mType;
1407 retval.mStringType = NameValueTypeStrings[a.mType];
1408 delete retval.mNameValueReference.vec3;
1409 retval.mNameValueReference.vec3 = new LLVector3(*a.mNameValueReference.vec3 - *b.mNameValueReference.vec3);
1410 }
1411 break;
1412 default:
1413 llerrs << "Unknown subtract of NV type " << a.mStringType << " to " << b.mStringType << llendl;
1414 break;
1415 }
1416 return retval;
1417}
1418
1419LLNameValue &operator*(const LLNameValue &a, const LLNameValue &b)
1420{
1421 static LLNameValue retval;
1422
1423 switch(a.mType)
1424 {
1425 case NVT_STRING:
1426 break;
1427 case NVT_F32:
1428 if (b.mType == NVT_F32)
1429 {
1430 retval.mType = NVT_F32;
1431 retval.mStringType = NameValueTypeStrings[NVT_F32];
1432 delete retval.mNameValueReference.f32;
1433 retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.f32 * *b.mNameValueReference.f32);
1434 }
1435 else if (b.mType == NVT_S32)
1436 {
1437 retval.mType = NVT_F32;
1438 retval.mStringType = NameValueTypeStrings[NVT_F32];
1439 delete retval.mNameValueReference.f32;
1440 retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.f32 * *b.mNameValueReference.s32);
1441 }
1442 else if (b.mType == NVT_U32)
1443 {
1444 retval.mType = NVT_F32;
1445 retval.mStringType = NameValueTypeStrings[NVT_F32];
1446 delete retval.mNameValueReference.f32;
1447 retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.f32 * *b.mNameValueReference.u32);
1448 }
1449 break;
1450 case NVT_S32:
1451 if (b.mType == NVT_F32)
1452 {
1453 retval.mType = NVT_F32;
1454 retval.mStringType = NameValueTypeStrings[NVT_F32];
1455 delete retval.mNameValueReference.f32;
1456 retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.s32 * *b.mNameValueReference.f32);
1457 }
1458 else if (b.mType == NVT_S32)
1459 {
1460 retval.mType = NVT_S32;
1461 retval.mStringType = NameValueTypeStrings[NVT_S32];
1462 delete retval.mNameValueReference.s32;
1463 retval.mNameValueReference.s32 = new S32(*a.mNameValueReference.s32 * *b.mNameValueReference.s32);
1464 }
1465 else if (b.mType == NVT_U32)
1466 {
1467 retval.mType = NVT_S32;
1468 retval.mStringType = NameValueTypeStrings[NVT_S32];
1469 delete retval.mNameValueReference.s32;
1470 retval.mNameValueReference.s32 = new S32(*a.mNameValueReference.s32 * *b.mNameValueReference.u32);
1471 }
1472 break;
1473 case NVT_U32:
1474 if (b.mType == NVT_F32)
1475 {
1476 retval.mType = NVT_F32;
1477 retval.mStringType = NameValueTypeStrings[NVT_F32];
1478 delete retval.mNameValueReference.f32;
1479 retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.u32 * *b.mNameValueReference.f32);
1480 }
1481 else if (b.mType == NVT_S32)
1482 {
1483 retval.mType = NVT_S32;
1484 retval.mStringType = NameValueTypeStrings[NVT_S32];
1485 delete retval.mNameValueReference.s32;
1486 retval.mNameValueReference.s32 = new S32(*a.mNameValueReference.u32 * *b.mNameValueReference.s32);
1487 }
1488 else if (b.mType == NVT_U32)
1489 {
1490 retval.mType = NVT_U32;
1491 retval.mStringType = NameValueTypeStrings[NVT_U32];
1492 delete retval.mNameValueReference.u32;
1493 retval.mNameValueReference.u32 = new U32(*a.mNameValueReference.u32 * *b.mNameValueReference.u32);
1494 }
1495 break;
1496 case NVT_VEC3:
1497 if ( (a.mType == b.mType)
1498 &&(a.mType == NVT_VEC3))
1499 {
1500 retval.mType = NVT_F32;
1501 retval.mStringType = NameValueTypeStrings[a.mType];
1502 delete retval.mNameValueReference.f32;
1503 retval.mNameValueReference.f32 = new F32((*a.mNameValueReference.vec3) * (*b.mNameValueReference.vec3));
1504 }
1505 break;
1506 default:
1507 llerrs << "Unknown multiply of NV type " << a.mStringType << " to " << b.mStringType << llendl;
1508 break;
1509 }
1510 return retval;
1511}
1512
1513LLNameValue &operator/(const LLNameValue &a, const LLNameValue &b)
1514{
1515 static LLNameValue retval;
1516
1517 switch(a.mType)
1518 {
1519 case NVT_STRING:
1520 break;
1521 case NVT_F32:
1522 if (b.mType == NVT_F32)
1523 {
1524 retval.mType = NVT_F32;
1525 retval.mStringType = NameValueTypeStrings[NVT_F32];
1526 delete retval.mNameValueReference.f32;
1527 retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.f32 / *b.mNameValueReference.f32);
1528 }
1529 else if (b.mType == NVT_S32)
1530 {
1531 retval.mType = NVT_F32;
1532 retval.mStringType = NameValueTypeStrings[NVT_F32];
1533 delete retval.mNameValueReference.f32;
1534 retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.f32 / *b.mNameValueReference.s32);
1535 }
1536 else if (b.mType == NVT_U32)
1537 {
1538 retval.mType = NVT_F32;
1539 retval.mStringType = NameValueTypeStrings[NVT_F32];
1540 delete retval.mNameValueReference.f32;
1541 retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.f32 / *b.mNameValueReference.u32);
1542 }
1543 break;
1544 case NVT_S32:
1545 if (b.mType == NVT_F32)
1546 {
1547 retval.mType = NVT_F32;
1548 retval.mStringType = NameValueTypeStrings[NVT_F32];
1549 delete retval.mNameValueReference.f32;
1550 retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.s32 / *b.mNameValueReference.f32);
1551 }
1552 else if (b.mType == NVT_S32)
1553 {
1554 retval.mType = NVT_S32;
1555 retval.mStringType = NameValueTypeStrings[NVT_S32];
1556 delete retval.mNameValueReference.s32;
1557 retval.mNameValueReference.s32 = new S32(*a.mNameValueReference.s32 / *b.mNameValueReference.s32);
1558 }
1559 else if (b.mType == NVT_U32)
1560 {
1561 retval.mType = NVT_S32;
1562 retval.mStringType = NameValueTypeStrings[NVT_S32];
1563 delete retval.mNameValueReference.s32;
1564 retval.mNameValueReference.s32 = new S32(*a.mNameValueReference.s32 / *b.mNameValueReference.u32);
1565 }
1566 break;
1567 case NVT_U32:
1568 if (b.mType == NVT_F32)
1569 {
1570 retval.mType = NVT_F32;
1571 retval.mStringType = NameValueTypeStrings[NVT_F32];
1572 delete retval.mNameValueReference.f32;
1573 retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.u32 / *b.mNameValueReference.f32);
1574 }
1575 else if (b.mType == NVT_S32)
1576 {
1577 retval.mType = NVT_S32;
1578 retval.mStringType = NameValueTypeStrings[NVT_S32];
1579 delete retval.mNameValueReference.s32;
1580 retval.mNameValueReference.s32 = new S32(*a.mNameValueReference.u32 / *b.mNameValueReference.s32);
1581 }
1582 else if (b.mType == NVT_U32)
1583 {
1584 retval.mType = NVT_U32;
1585 retval.mStringType = NameValueTypeStrings[NVT_U32];
1586 delete retval.mNameValueReference.u32;
1587 retval.mNameValueReference.u32 = new U32(*a.mNameValueReference.u32 / *b.mNameValueReference.u32);
1588 }
1589 break;
1590 default:
1591 llerrs << "Unknown divide of NV type " << a.mStringType << " to " << b.mStringType << llendl;
1592 break;
1593 }
1594 return retval;
1595}
1596
1597LLNameValue &operator%(const LLNameValue &a, const LLNameValue &b)
1598{
1599 static LLNameValue retval;
1600
1601 switch(a.mType)
1602 {
1603 case NVT_STRING:
1604 break;
1605 case NVT_F32:
1606 break;
1607 case NVT_S32:
1608 if (b.mType == NVT_S32)
1609 {
1610 retval.mType = NVT_S32;
1611 retval.mStringType = NameValueTypeStrings[NVT_S32];
1612 delete retval.mNameValueReference.s32;
1613 retval.mNameValueReference.s32 = new S32(*a.mNameValueReference.s32 % *b.mNameValueReference.s32);
1614 }
1615 else if (b.mType == NVT_U32)
1616 {
1617 retval.mType = NVT_S32;
1618 retval.mStringType = NameValueTypeStrings[NVT_S32];
1619 delete retval.mNameValueReference.s32;
1620 retval.mNameValueReference.s32 = new S32(*a.mNameValueReference.s32 % *b.mNameValueReference.u32);
1621 }
1622 break;
1623 case NVT_U32:
1624 if (b.mType == NVT_S32)
1625 {
1626 retval.mType = NVT_S32;
1627 retval.mStringType = NameValueTypeStrings[NVT_S32];
1628 delete retval.mNameValueReference.s32;
1629 retval.mNameValueReference.s32 = new S32(*a.mNameValueReference.u32 % *b.mNameValueReference.s32);
1630 }
1631 else if (b.mType == NVT_U32)
1632 {
1633 retval.mType = NVT_U32;
1634 retval.mStringType = NameValueTypeStrings[NVT_U32];
1635 delete retval.mNameValueReference.u32;
1636 retval.mNameValueReference.u32 = new U32(*a.mNameValueReference.u32 % *b.mNameValueReference.u32);
1637 }
1638 break;
1639 case NVT_VEC3:
1640 if ( (a.mType == b.mType)
1641 &&(a.mType == NVT_VEC3))
1642 {
1643 retval.mType = a.mType;
1644 retval.mStringType = NameValueTypeStrings[a.mType];
1645 delete retval.mNameValueReference.vec3;
1646 retval.mNameValueReference.vec3 = new LLVector3(*a.mNameValueReference.vec3 % *b.mNameValueReference.vec3);
1647 }
1648 break;
1649 default:
1650 llerrs << "Unknown % of NV type " << a.mStringType << " to " << b.mStringType << llendl;
1651 break;
1652 }
1653 return retval;
1654}
1655
1656
1657// Multiplying anything times a float gives you some floats
1658LLNameValue &operator*(const LLNameValue &a, F32 k)
1659{
1660 static LLNameValue retval;
1661
1662 switch(a.mType)
1663 {
1664 case NVT_STRING:
1665 break;
1666 case NVT_F32:
1667 retval.mType = NVT_F32;
1668 retval.mStringType = NameValueTypeStrings[NVT_F32];
1669 delete retval.mNameValueReference.f32;
1670 retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.f32 * k);
1671 break;
1672 case NVT_S32:
1673 retval.mType = NVT_F32;
1674 retval.mStringType = NameValueTypeStrings[NVT_F32];
1675 delete retval.mNameValueReference.f32;
1676 retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.s32 * k);
1677 break;
1678 case NVT_U32:
1679 retval.mType = NVT_F32;
1680 retval.mStringType = NameValueTypeStrings[NVT_F32];
1681 delete retval.mNameValueReference.f32;
1682 retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.u32 * k);
1683 break;
1684 case NVT_VEC3:
1685 retval.mType = a.mType;
1686 retval.mStringType = NameValueTypeStrings[a.mType];
1687 delete retval.mNameValueReference.vec3;
1688 retval.mNameValueReference.vec3 = new LLVector3(*a.mNameValueReference.vec3 * k);
1689 break;
1690 default:
1691 llerrs << "Unknown multiply of NV type " << a.mStringType << " with F32" << llendl;
1692 break;
1693 }
1694 return retval;
1695}
1696
1697
1698LLNameValue &operator*(F32 k, const LLNameValue &a)
1699{
1700 static LLNameValue retval;
1701
1702 switch(a.mType)
1703 {
1704 case NVT_STRING:
1705 break;
1706 case NVT_F32:
1707 retval.mType = NVT_F32;
1708 retval.mStringType = NameValueTypeStrings[NVT_F32];
1709 delete retval.mNameValueReference.f32;
1710 retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.f32 * k);
1711 break;
1712 case NVT_S32:
1713 retval.mType = NVT_F32;
1714 retval.mStringType = NameValueTypeStrings[NVT_F32];
1715 delete retval.mNameValueReference.f32;
1716 retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.s32 * k);
1717 break;
1718 case NVT_U32:
1719 retval.mType = NVT_F32;
1720 retval.mStringType = NameValueTypeStrings[NVT_F32];
1721 delete retval.mNameValueReference.f32;
1722 retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.u32 * k);
1723 break;
1724 case NVT_VEC3:
1725 retval.mType = a.mType;
1726 retval.mStringType = NameValueTypeStrings[a.mType];
1727 delete retval.mNameValueReference.vec3;
1728 retval.mNameValueReference.vec3 = new LLVector3(*a.mNameValueReference.vec3 * k);
1729 break;
1730 default:
1731 llerrs << "Unknown multiply of NV type " << a.mStringType << " with F32" << llendl;
1732 break;
1733 }
1734 return retval;
1735}
1736
1737
1738bool operator==(const LLNameValue &a, const LLNameValue &b)
1739{
1740 switch(a.mType)
1741 {
1742 case NVT_STRING:
1743 if (b.mType == NVT_STRING)
1744 {
1745 if (!a.mNameValueReference.string)
1746 return FALSE;
1747 if (!b.mNameValueReference.string)
1748 return FALSE;
1749 return (!strcmp(a.mNameValueReference.string, b.mNameValueReference.string));
1750 }
1751 break;
1752 case NVT_F32:
1753 if (b.mType == NVT_F32)
1754 {
1755 return (*a.mNameValueReference.f32 == *b.mNameValueReference.f32);
1756 }
1757 else if (b.mType == NVT_S32)
1758 {
1759 return (*a.mNameValueReference.f32 == *b.mNameValueReference.s32);
1760 }
1761 else if (b.mType == NVT_U32)
1762 {
1763 return (*a.mNameValueReference.f32 == *b.mNameValueReference.u32);
1764 }
1765 break;
1766 case NVT_S32:
1767 if (b.mType == NVT_F32)
1768 {
1769 return (*a.mNameValueReference.s32 == *b.mNameValueReference.f32);
1770 }
1771 else if (b.mType == NVT_S32)
1772 {
1773 return (*a.mNameValueReference.s32 == *b.mNameValueReference.s32);
1774 }
1775 else if (b.mType == NVT_U32)
1776 {
1777 return (*a.mNameValueReference.s32 == (S32) *b.mNameValueReference.u32);
1778 }
1779 break;
1780 case NVT_U32:
1781 if (b.mType == NVT_F32)
1782 {
1783 return (*a.mNameValueReference.u32 == *b.mNameValueReference.f32);
1784 }
1785 else if (b.mType == NVT_S32)
1786 {
1787 return ((S32) *a.mNameValueReference.u32 == *b.mNameValueReference.s32);
1788 }
1789 else if (b.mType == NVT_U32)
1790 {
1791 return (*a.mNameValueReference.u32 == *b.mNameValueReference.u32);
1792 }
1793 break;
1794 case NVT_VEC3:
1795 if ( (a.mType == b.mType)
1796 &&(a.mType == NVT_VEC3))
1797 {
1798 return (*a.mNameValueReference.vec3 == *b.mNameValueReference.vec3);
1799 }
1800 break;
1801 default:
1802 llerrs << "Unknown == NV type " << a.mStringType << " with " << b.mStringType << llendl;
1803 break;
1804 }
1805 return FALSE;
1806}
1807
1808bool operator<=(const LLNameValue &a, const LLNameValue &b)
1809{
1810 switch(a.mType)
1811 {
1812 case NVT_STRING:
1813 if (b.mType == NVT_STRING)
1814 {
1815 S32 retval = strcmp(a.mNameValueReference.string, b.mNameValueReference.string);
1816 return (retval <= 0);
1817 }
1818 break;
1819 case NVT_F32:
1820 if (b.mType == NVT_F32)
1821 {
1822 return (*a.mNameValueReference.f32 <= *b.mNameValueReference.f32);
1823 }
1824 else if (b.mType == NVT_S32)
1825 {
1826 return (*a.mNameValueReference.f32 <= *b.mNameValueReference.s32);
1827 }
1828 else if (b.mType == NVT_U32)
1829 {
1830 return (*a.mNameValueReference.f32 <= *b.mNameValueReference.u32);
1831 }
1832 break;
1833 case NVT_S32:
1834 if (b.mType == NVT_F32)
1835 {
1836 return (*a.mNameValueReference.s32 <= *b.mNameValueReference.f32);
1837 }
1838 else if (b.mType == NVT_S32)
1839 {
1840 return (*a.mNameValueReference.s32 <= *b.mNameValueReference.s32);
1841 }
1842 else if (b.mType == NVT_U32)
1843 {
1844 return (*a.mNameValueReference.s32 <= (S32) *b.mNameValueReference.u32);
1845 }
1846 break;
1847 case NVT_U32:
1848 if (b.mType == NVT_F32)
1849 {
1850 return (*a.mNameValueReference.u32 <= *b.mNameValueReference.f32);
1851 }
1852 else if (b.mType == NVT_S32)
1853 {
1854 return ((S32) *a.mNameValueReference.u32 <= *b.mNameValueReference.s32);
1855 }
1856 else if (b.mType == NVT_U32)
1857 {
1858 return (*a.mNameValueReference.u32 <= *b.mNameValueReference.u32);
1859 }
1860 break;
1861 default:
1862 llerrs << "Unknown <= NV type " << a.mStringType << " with " << b.mStringType << llendl;
1863 break;
1864 }
1865 return FALSE;
1866}
1867
1868
1869bool operator>=(const LLNameValue &a, const LLNameValue &b)
1870{
1871 switch(a.mType)
1872 {
1873 case NVT_STRING:
1874 if ( (a.mType == b.mType)
1875 &&(a.mType == NVT_STRING))
1876 {
1877 S32 retval = strcmp(a.mNameValueReference.string, b.mNameValueReference.string);
1878 return (retval >= 0);
1879 }
1880 break;
1881 case NVT_F32:
1882 if (b.mType == NVT_F32)
1883 {
1884 return (*a.mNameValueReference.f32 >= *b.mNameValueReference.f32);
1885 }
1886 else if (b.mType == NVT_S32)
1887 {
1888 return (*a.mNameValueReference.f32 >= *b.mNameValueReference.s32);
1889 }
1890 else if (b.mType == NVT_U32)
1891 {
1892 return (*a.mNameValueReference.f32 >= *b.mNameValueReference.u32);
1893 }
1894 break;
1895 case NVT_S32:
1896 if (b.mType == NVT_F32)
1897 {
1898 return (*a.mNameValueReference.s32 >= *b.mNameValueReference.f32);
1899 }
1900 else if (b.mType == NVT_S32)
1901 {
1902 return (*a.mNameValueReference.s32 >= *b.mNameValueReference.s32);
1903 }
1904 else if (b.mType == NVT_U32)
1905 {
1906 return (*a.mNameValueReference.s32 >= (S32) *b.mNameValueReference.u32);
1907 }
1908 break;
1909 case NVT_U32:
1910 if (b.mType == NVT_F32)
1911 {
1912 return (*a.mNameValueReference.u32 >= *b.mNameValueReference.f32);
1913 }
1914 else if (b.mType == NVT_S32)
1915 {
1916 return ((S32) *a.mNameValueReference.u32 >= *b.mNameValueReference.s32);
1917 }
1918 else if (b.mType == NVT_U32)
1919 {
1920 return (*a.mNameValueReference.u32 >= *b.mNameValueReference.u32);
1921 }
1922 break;
1923 default:
1924 llerrs << "Unknown >= NV type " << a.mStringType << " with " << b.mStringType << llendl;
1925 break;
1926 }
1927 return FALSE;
1928}
1929
1930
1931bool operator<(const LLNameValue &a, const LLNameValue &b)
1932{
1933 switch(a.mType)
1934 {
1935 case NVT_STRING:
1936 if ( (a.mType == b.mType)
1937 &&(a.mType == NVT_STRING))
1938 {
1939 S32 retval = strcmp(a.mNameValueReference.string, b.mNameValueReference.string);
1940 return (retval < 0);
1941 }
1942 break;
1943 case NVT_F32:
1944 if (b.mType == NVT_F32)
1945 {
1946 return (*a.mNameValueReference.f32 < *b.mNameValueReference.f32);
1947 }
1948 else if (b.mType == NVT_S32)
1949 {
1950 return (*a.mNameValueReference.f32 < *b.mNameValueReference.s32);
1951 }
1952 else if (b.mType == NVT_U32)
1953 {
1954 return (*a.mNameValueReference.f32 < *b.mNameValueReference.u32);
1955 }
1956 break;
1957 case NVT_S32:
1958 if (b.mType == NVT_F32)
1959 {
1960 return (*a.mNameValueReference.s32 < *b.mNameValueReference.f32);
1961 }
1962 else if (b.mType == NVT_S32)
1963 {
1964 return (*a.mNameValueReference.s32 < *b.mNameValueReference.s32);
1965 }
1966 else if (b.mType == NVT_U32)
1967 {
1968 return (*a.mNameValueReference.s32 < (S32) *b.mNameValueReference.u32);
1969 }
1970 break;
1971 case NVT_U32:
1972 if (b.mType == NVT_F32)
1973 {
1974 return (*a.mNameValueReference.u32 < *b.mNameValueReference.f32);
1975 }
1976 else if (b.mType == NVT_S32)
1977 {
1978 return ((S32) *a.mNameValueReference.u32 < *b.mNameValueReference.s32);
1979 }
1980 else if (b.mType == NVT_U32)
1981 {
1982 return (*a.mNameValueReference.u32 < *b.mNameValueReference.u32);
1983 }
1984 break;
1985 default:
1986 llerrs << "Unknown < NV type " << a.mStringType << " with " << b.mStringType << llendl;
1987 break;
1988 }
1989 return FALSE;
1990}
1991
1992
1993bool operator>(const LLNameValue &a, const LLNameValue &b)
1994{
1995 switch(a.mType)
1996 {
1997 case NVT_STRING:
1998 if ( (a.mType == b.mType)
1999 &&(a.mType == NVT_STRING))
2000 {
2001 S32 retval = strcmp(a.mNameValueReference.string, b.mNameValueReference.string);
2002 return (retval > 0);
2003 }
2004 break;
2005 case NVT_F32:
2006 if (b.mType == NVT_F32)
2007 {
2008 return (*a.mNameValueReference.f32 > *b.mNameValueReference.f32);
2009 }
2010 else if (b.mType == NVT_S32)
2011 {
2012 return (*a.mNameValueReference.f32 > *b.mNameValueReference.s32);
2013 }
2014 else if (b.mType == NVT_U32)
2015 {
2016 return (*a.mNameValueReference.f32 > *b.mNameValueReference.u32);
2017 }
2018 break;
2019 case NVT_S32:
2020 if (b.mType == NVT_F32)
2021 {
2022 return (*a.mNameValueReference.s32 > *b.mNameValueReference.f32);
2023 }
2024 else if (b.mType == NVT_S32)
2025 {
2026 return (*a.mNameValueReference.s32 > *b.mNameValueReference.s32);
2027 }
2028 else if (b.mType == NVT_U32)
2029 {
2030 return (*a.mNameValueReference.s32 > (S32) *b.mNameValueReference.u32);
2031 }
2032 break;
2033 case NVT_U32:
2034 if (b.mType == NVT_F32)
2035 {
2036 return (*a.mNameValueReference.u32 > *b.mNameValueReference.f32);
2037 }
2038 else if (b.mType == NVT_S32)
2039 {
2040 return ((S32) *a.mNameValueReference.u32 > *b.mNameValueReference.s32);
2041 }
2042 else if (b.mType == NVT_U32)
2043 {
2044 return (*a.mNameValueReference.u32 > *b.mNameValueReference.u32);
2045 }
2046 break;
2047 default:
2048 llerrs << "Unknown > NV type " << a.mStringType << " with " << b.mStringType << llendl;
2049 break;
2050 }
2051 return FALSE;
2052}
2053
2054bool operator!=(const LLNameValue &a, const LLNameValue &b)
2055{
2056 switch(a.mType)
2057 {
2058 case NVT_STRING:
2059 if ( (a.mType == b.mType)
2060 &&(a.mType == NVT_STRING))
2061 {
2062 return (strcmp(a.mNameValueReference.string, b.mNameValueReference.string)) ? true : false;
2063 }
2064 break;
2065 case NVT_F32:
2066 if (b.mType == NVT_F32)
2067 {
2068 return (*a.mNameValueReference.f32 != *b.mNameValueReference.f32);
2069 }
2070 else if (b.mType == NVT_S32)
2071 {
2072 return (*a.mNameValueReference.f32 != *b.mNameValueReference.s32);
2073 }
2074 else if (b.mType == NVT_U32)
2075 {
2076 return (*a.mNameValueReference.f32 != *b.mNameValueReference.u32);
2077 }
2078 break;
2079 case NVT_S32:
2080 if (b.mType == NVT_F32)
2081 {
2082 return (*a.mNameValueReference.s32 != *b.mNameValueReference.f32);
2083 }
2084 else if (b.mType == NVT_S32)
2085 {
2086 return (*a.mNameValueReference.s32 != *b.mNameValueReference.s32);
2087 }
2088 else if (b.mType == NVT_U32)
2089 {
2090 return (*a.mNameValueReference.s32 != (S32) *b.mNameValueReference.u32);
2091 }
2092 break;
2093 case NVT_U32:
2094 if (b.mType == NVT_F32)
2095 {
2096 return (*a.mNameValueReference.u32 != *b.mNameValueReference.f32);
2097 }
2098 else if (b.mType == NVT_S32)
2099 {
2100 return ((S32) *a.mNameValueReference.u32 != *b.mNameValueReference.s32);
2101 }
2102 else if (b.mType == NVT_U32)
2103 {
2104 return (*a.mNameValueReference.u32 != *b.mNameValueReference.u32);
2105 }
2106 break;
2107 case NVT_VEC3:
2108 if ( (a.mType == b.mType)
2109 &&(a.mType == NVT_VEC3))
2110 {
2111 return (*a.mNameValueReference.vec3 != *b.mNameValueReference.vec3);
2112 }
2113 break;
2114 default:
2115 llerrs << "Unknown != NV type " << a.mStringType << " with " << b.mStringType << llendl;
2116 break;
2117 }
2118 return FALSE;
2119}
2120
2121
2122LLNameValue &operator-(const LLNameValue &a)
2123{
2124 static LLNameValue retval;
2125
2126 switch(a.mType)
2127 {
2128 case NVT_STRING:
2129 break;
2130 case NVT_F32:
2131 retval.mType = a.mType;
2132 retval.mStringType = NameValueTypeStrings[a.mType];
2133 delete retval.mNameValueReference.f32;
2134 retval.mNameValueReference.f32 = new F32(-*a.mNameValueReference.f32);
2135 break;
2136 case NVT_S32:
2137 retval.mType = a.mType;
2138 retval.mStringType = NameValueTypeStrings[a.mType];
2139 delete retval.mNameValueReference.s32;
2140 retval.mNameValueReference.s32 = new S32(-*a.mNameValueReference.s32);
2141 break;
2142 case NVT_U32:
2143 retval.mType = NVT_S32;
2144 retval.mStringType = NameValueTypeStrings[NVT_S32];
2145 delete retval.mNameValueReference.s32;
2146 // Can't do unary minus on U32, doesn't work.
2147 retval.mNameValueReference.s32 = new S32(-S32(*a.mNameValueReference.u32));
2148 break;
2149 case NVT_VEC3:
2150 retval.mType = a.mType;
2151 retval.mStringType = NameValueTypeStrings[a.mType];
2152 delete retval.mNameValueReference.vec3;
2153 retval.mNameValueReference.vec3 = new LLVector3(-*a.mNameValueReference.vec3);
2154 break;
2155 default:
2156 llerrs << "Unknown - NV type " << a.mStringType << llendl;
2157 break;
2158 }
2159 return retval;
2160}