Home | History | Annotate | Download | only in dae
      1 /*
      2 * Copyright 2006 Sony Computer Entertainment Inc.
      3 *
      4 * Licensed under the MIT Open Source License, for details please see license.txt or the website
      5 * http://www.opensource.org/licenses/mit-license.php
      6 *
      7 */
      8 
      9 #include <dae/daeStringRef.h>
     10 
     11 //Contributed by Nus - Wed, 08 Nov 2006
     12 // Nus: Use global pointer instead of local static.
     13 static daeStringTable *pST = NULL;
     14 //---------------------------
     15 
     16 daeStringTable &daeStringRef::_stringTable()
     17 {
     18 //Contributed by Nus - Wed, 08 Nov 2006
     19   // static daeStringTable *st = new daeStringTable();
     20   // return *st;
     21   if(!pST)
     22     pST = new daeStringTable();
     23   return *pST;
     24 }
     25 
     26 void daeStringRef::releaseStringTable(void)
     27 {
     28   if(pST) {
     29     delete pST;
     30     pST = NULL;
     31   }
     32 }
     33 //--------------------------------
     34 
     35 daeStringRef::daeStringRef(daeString string)
     36 {
     37 	daeStringTable &st = _stringTable();
     38 	_string = st.allocString(string);
     39 }
     40 
     41 const daeStringRef&
     42 daeStringRef::set(daeString string)
     43 {
     44 	daeStringTable &st = _stringTable();
     45 	_string = st.allocString(string);
     46 	return *this;
     47 }
     48 
     49 const daeStringRef&
     50 daeStringRef::operator= (daeString string)
     51 {
     52 	return set(string);
     53 }
     54