summaryrefslogtreecommitdiff
path: root/core/fxcrt/include/fx_string.h
AgeCommit message (Collapse)Author
2016-05-13Make CFX_ByteString(const CFX_ByteStringC&) explicit.tsepez
Add missing helper function to CFX_ByteTextBuf to avoid the anti-pattern CFX_ByteString(sBuf.AsStringC()), using the name "Make" to indicate there's an allocation going on in this case. Change some method arguments to take pre-existing ByteStrings where possible. Review-Url: https://codereview.chromium.org/1977093002
2016-05-13Make CFX_WideString(const CFX_WideString&) explicit.tsepez
BUG= Review-Url: https://codereview.chromium.org/1979723003
2016-05-13Templatize CFX_{Byte,Wide}StringCtsepez
Review-Url: https://codereview.chromium.org/1874773002
2016-05-12Add CFX_ByteStringC::CharAt() to avoid c_str() and casts.tsepez
Most of the time, we want to operate on chars as if they were unsigned, but there are a few places where we need the default (questionably signed) values. Consolidate the casting in a single place rather than forcing callers to get a char* ptr. BUG=pdfium:493 Review-Url: https://codereview.chromium.org/1972053003
2016-05-12Fix comment in fx_string.htsepez
Previous CLs have removed or marked explicit the constructors which allowed bad constructs to compile. I now get an error: candidate constructor not viable: expects an l-value for 1st argument when called as indicated in the comment. Review-Url: https://codereview.chromium.org/1975983002
2016-05-11Add much-needed Find() method for CFX_*StringCtsepez
BUG=pdfium:493 Review-Url: https://codereview.chromium.org/1968233002
2016-05-11Use bytestringC rather than raw ptr/len pairs in syntax parsertsepez
In particular, we seek to make more use of the .Mid() (substr) method to make these. Precursor to removing c_str() calls. BUG=pdfium:493 Review-Url: https://codereview.chromium.org/1966293002
2016-04-20Inline CFX_WideString::c_str.dsinclair
This was causing issues at one point with the GN build but seems to have been resolved in the meantime. Review URL: https://codereview.chromium.org/1907563002
2016-04-20Standalone GN build.dsinclair
This CL setups up a standalone GN build. You'll need to set gn args similar to: use_goma = true clang_use_chrome_plugins = false pdf_enable_xfa = true pdf_enable_v8 = true pdf_is_standalone = true The third_party/pymock files are needed to make git cl upload work correctly. BUG=pdfium:106 Review URL: https://codereview.chromium.org/1904563002
2016-04-19Remove a few more char* members from structs/classes.tsepez
This is a result of looking for the anti-paterns /char\*\sm_/ and /m_.*=.*\.c_str/ which indicate that a class may be using the contents of a string without extending the lifetime of the underlying storage. Along the way, change to uint8_t in fx_dib; this is unrelated but avoids grep hits (it is binary, not chars anyways). Also remove two string operators that make it easy to assign in a manner that does not extend contents lifetime. Review URL: https://codereview.chromium.org/1902953002
2016-04-14Still more comments about stringstsepez
TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1888843004
2016-04-14Update comments about string constructorstsepez
TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1887003003
2016-04-14Replace calls to deprecated CFX_{Wide,Byte}String::Empty()tsepez
Use the more standard name "clear()" instead. Review URL: https://codereview.chromium.org/1888103002
2016-04-13Remove implicit cast from CFX_WideString to (const wchar_t*)tsepez
BUG= Review URL: https://codereview.chromium.org/1882043004
2016-04-13Remove implicit cast from CFX_ByteString to (const char*).tsepez
BUG= Review URL: https://codereview.chromium.org/1885973002
2016-04-11Avoid copying in TrimRight() and TrimLeft() if possible.tsepez
Make Byte and Wide code identical while at it. Review URL: https://codereview.chromium.org/1877553002
2016-04-08Make converstion explicit from CFX_ByteString to uint8_t*tsepez
BUG= Review URL: https://codereview.chromium.org/1868293002
2016-04-08Rename both As{Byte,Wide}StringC() helpers to AsStringC().tsepez
The naming is redundant given the base type, and will stand in the way of consolidating Byte and Wide code. BUG= Review URL: https://codereview.chromium.org/1862123003
2016-04-08Remove CFX_ByteString::Load() and operator= for CFX_ByteTextBuftsepez
The few places these are called are better served by explicit calls to CFX_ByteString() itself. This helps make Byte and Wide strings more similar. Also prevents fx_string.h from having any knowledge of fx_basic.h's ByteTextBuf class. Review URL: https://codereview.chromium.org/1870043003
2016-04-08Make CFX_WideString::FromLocal() take a CFX_ByteStringC argtsepez
It doesn't persist the string beyond the duration of the call, hence it should take the *StringC variant. Doing so avoids some allocs by changing to the *StringC ctor in a few places, at the cost of some explicit .ToByteStringC() calls (which are cheap). Review URL: https://codereview.chromium.org/1862953004
2016-04-06Make wide strings use StringData templatetsepez
Shuffled the order of methods in fx_basic_wstring.cpp to match those in fx_basic_bstring.cpp. The way to review this patch is to diff those two files against each other. They are beginning to converge. Re-ordered some parameters in Concat() so that the string comes before its length. It feels wrong otherwise. Review URL: https://codereview.chromium.org/1846793002
2016-04-06Make CFX_WideString::FromUTF8() take a CFX_ByteStringC argument.tsepez
Methods that take string arguments and do not persist them should take *StringC types as argument rather than discrete ptr/len args. Avoids a number of implicit casts from CFX_ByteString to char*. BUG= Review URL: https://codereview.chromium.org/1861183002
2016-04-06Rename CFX_WideStringC::raw_str() to c_str()tsepez
No functional change intended. This difference in naming is standing in the way of consolidating some of the string code between Wide and Byte strings. The Wide code wants to call raw_str() in exactly the same spots that the Byte code calls c_str(). This makes sense, because in both places we get a character type back, and not a uint*_t type. If WideStringC had a raw_str() method, it would have to return uint32_t or similar. R=dsinclair@chromium.org Review URL: https://codereview.chromium.org/1863593004
2016-04-05Make StringData a templated class.tsepez
First step in making the same changes to CFX_WideString that we just made to CFX_ByteString. Review URL: https://codereview.chromium.org/1844073003
2016-04-05Make down-conversion explicit from CFX_Widetring to CFX_WideStringC.tsepez
Companion to https://codereview.chromium.org/1853233002 BUG= Review URL: https://codereview.chromium.org/1857073002
2016-04-05Rename GetCStr and GetPtr to match CFX_ByteString.dsinclair
This CL updates CFX_ByteStringC to use the more common c_str and raw_str instead of GetCStr and GetPtr. Review URL: https://codereview.chromium.org/1857713003
2016-04-04Make down-conversion explicit from CFX_ByteString to CFX_ByteStringC.tsepez
Having this happen implicitly can be dangerous because the lifetime has to be considered; we should have caught the "red bots" in https://codereview.chromium.org/1847333004/#ps60001 at compile time. Review URL: https://codereview.chromium.org/1853233002
2016-04-01Re-land "Use CFX_RetainPtr to ref count CFX_ByteString""tsepez
This reverts commit b33dfdf68bafa30e90a65fb71ff6b343202e0561. BUG= Review URL: https://codereview.chromium.org/1848993002
2016-04-01Remove CFX_{Byte,Wide}String::Equal in favor of "==".tsepez
Makes the code slightly cleaner. Review URL: https://codereview.chromium.org/1846083002
2016-03-31Revert "Use CFX_RetainPtr to ref count CFX_ByteString"chromium/2700chromium/2699chromium/2698chromium/2697tsepez
This reverts commit ac88953dfa7c1a68c69989d61d7bc03c0595064b. Reason for revert: Strings borked. TBR=dsinclair@chromium.org Review URL: https://codereview.chromium.org/1852453004
2016-03-30Use CFX_RetainPtr to ref count CFX_ByteStringchromium/2696tsepez
This moves the reference counts from an ad-hoc mechanism to being automatically tracked. Also: Make StringData::Create() always return non-null. Add better ctors for StringData itself. Consolidate copies into StringData methods. Simplify the concat() code. Rename/reorder some parameter names to be simpler. Review URL: https://codereview.chromium.org/1810823002
2016-03-29Code change to avoid signed/unsigned mismatch warnings.Wei Li
This makes pdfium code on Linux and Mac sign-compare warning free. The warning flag will be re-enabled after checking on windows clang build. BUG=pdfium:29 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1841643002 .
2016-03-25Remove FX_DWORD from core/ and delete definitionchromium/2695chromium/2694chromium/2693chromium/2692tsepez
Review URL: https://codereview.chromium.org/1832173003
2016-03-23Move core/include/fxcrt to core/fxcrt/include.Dan Sinclair
This CL moves the fxcrt code into the core/fxcrt directory. The only exception was fx_bidi.h which was moved into core/fxcrt as it is not used outside of core/. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1825953002 .