~canonical-dx-team/nux/nux.fix-702538

« back to all changes in this revision

Viewing changes to NuxCore/TextString.cpp

  • Committer: Jay Taoko
  • Date: 2011-01-04 03:57:29 UTC
  • mfrom: (157.1.13 nux-holidays)
  • Revision ID: jay.taoko@canonical.com-20110104035729-0xh3iabo7e7dk371
* Added support to copy a texture from the current render target
* Blur, Color matrix, Exponent shaders
* Gaussian blur
* Bug fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
115
115
    SQWORD      Num                                     = InNum; // This avoids having to deal with negating -MaxS32 - 1
116
116
    NString NumberString;
117
117
    const TCHAR *NumberChar[10]         = { TEXT ("0"), TEXT ("1"), TEXT ("2"), TEXT ("3"), TEXT ("4"), TEXT ("5"), TEXT ("6"), TEXT ("7"), TEXT ("8"), TEXT ("9") };
118
 
    bool        bIsNumberNegative       = FALSE;
 
118
    bool        bIsNumberNegative       = false;
119
119
 
120
120
    // Correctly handle negative numbers and convert to positive integer.
121
121
    if (Num < 0)
122
122
    {
123
 
      bIsNumberNegative = TRUE;
 
123
      bIsNumberNegative = true;
124
124
      Num = -Num;
125
125
    }
126
126
 
338
338
 
339
339
  NString::NString()
340
340
  {
341
 
 
 
341
    m_string = TEXT("");
342
342
  }
343
343
 
344
344
  NString::NString (const NString &s)
435
435
    m_string.clear();
436
436
  }
437
437
 
438
 
  bool NString::IsEmpty()
 
438
  bool NString::IsEmpty() const
439
439
  {
440
440
    return m_string.empty();
441
441
  }
773
773
    t_size l = m_string.length() - 1;
774
774
 
775
775
    if (l < 0)
776
 
      return FALSE;
 
776
      return false;
777
777
 
778
778
    t_size pos = FindLastOccurence (suffix);
779
779
 
780
780
    if (pos == tstring::npos)
781
 
      return FALSE;
 
781
      return false;
782
782
 
783
783
    return (pos == l);
784
784
  }
788
788
    t_size sl = StringLength (suffix);
789
789
 
790
790
    if (sl == 0)
791
 
      return FALSE;
 
791
      return false;
792
792
 
793
793
    t_size l = m_string.length() - sl;
794
794
 
795
795
    if (l < 0)
796
 
      return FALSE;
 
796
      return false;
797
797
 
798
798
    t_size pos = FindLastOccurence (suffix);
799
799
 
800
800
    if (pos == tstring::npos)
801
 
      return FALSE;
 
801
      return false;
802
802
 
803
803
    return (pos == l);
804
804
  }
809
809
    t_size sl = suffix.length();
810
810
 
811
811
    if (sl == 0)
812
 
      return FALSE;
 
812
      return false;
813
813
 
814
814
    t_size l = m_string.length() - sl;
815
815
 
816
816
    if (l < 0)
817
 
      return FALSE;
 
817
      return false;
818
818
 
819
819
    t_size pos = FindLastOccurence (suffix);
820
820
 
821
821
    if (pos == tstring::npos)
822
 
      return FALSE;
 
822
      return false;
823
823
 
824
824
    return (pos == l);
825
825
  }
830
830
    t_size sl = suffix.Length();
831
831
 
832
832
    if (sl == 0)
833
 
      return FALSE;
 
833
      return false;
834
834
 
835
835
    t_size l = m_string.length() - sl;
836
836
 
837
837
    if (l < 0)
838
 
      return FALSE;
 
838
      return false;
839
839
 
840
840
    t_size pos = FindLastOccurence (suffix);
841
841
 
842
842
    if (pos == tstring::npos)
843
 
      return FALSE;
 
843
      return false;
844
844
 
845
845
    return (pos == l);
846
846
  }
851
851
    t_size l = m_string.length() - 1;
852
852
 
853
853
    if (l < 0)
854
 
      return FALSE;
 
854
      return false;
855
855
 
856
856
    t_size pos = FindFirstOccurence (prefix);
857
857
 
858
858
    if (pos == tstring::npos)
859
 
      return FALSE;
 
859
      return false;
860
860
 
861
861
    return (pos == 0);
862
862
  }
867
867
    t_size sl = StringLength (prefix);
868
868
 
869
869
    if (sl == 0)
870
 
      return FALSE;
 
870
      return false;
871
871
 
872
872
    t_size pos = FindFirstOccurence (prefix);
873
873
 
874
874
    if (pos == tstring::npos)
875
 
      return FALSE;
 
875
      return false;
876
876
 
877
877
    return (pos == 0);
878
878
  }
883
883
    t_size sl = prefix.length();
884
884
 
885
885
    if (sl == 0)
886
 
      return FALSE;
 
886
      return false;
887
887
 
888
888
    t_size pos = FindFirstOccurence (prefix);
889
889
 
890
890
    if (pos == tstring::npos)
891
 
      return FALSE;
 
891
      return false;
892
892
 
893
893
    return (pos == 0);
894
894
  }
898
898
    t_size sl = prefix.Length();
899
899
 
900
900
    if (sl == 0)
901
 
      return FALSE;
 
901
      return false;
902
902
 
903
903
    t_size pos = FindFirstOccurence (prefix);
904
904
 
905
905
    if (pos == tstring::npos)
906
 
      return FALSE;
 
906
      return false;
907
907
 
908
908
    return (pos == 0);
909
909
  }
1269
1269
    }
1270
1270
  }
1271
1271
 
1272
 
  TCHAR NString::GetFirstChar()
 
1272
  TCHAR NString::GetFirstChar() const
1273
1273
  {
1274
1274
    if (IsEmpty() )
1275
1275
      return 0;
1276
 
 
1277
1276
    return m_string[0];
1278
1277
  }
1279
1278
 
1280
 
  TCHAR NString::GetLastChar()
 
1279
  TCHAR NString::GetLastChar() const
1281
1280
  {
1282
1281
    if (IsEmpty() )
1283
1282
      return 0;
1284
 
 
1285
1283
    return m_string[Size()-1];
1286
1284
  }
1287
1285
 
1340
1338
    return o << s.m_string;
1341
1339
  }
1342
1340
 
 
1341
  /*!
 
1342
      Behave like printf. Use an internal buffer of 1024 characters. Do not use this function if you are expecting
 
1343
      the result to be more that 1024-1 characters.
 
1344
      @return A string with formated arguments in a NString.
 
1345
  */
1343
1346
  VARARG_BODY (NString, NString::Printf, const TCHAR *, VARARG_NONE)
1344
1347
  {
1345
1348
    t_u32  BufferSize  = 1024;