Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ocornut committed Oct 14, 2016
1 parent b8bfc58 commit 0d8f130
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ Functions:
Str256 s;
s.set("hello sailor"); // set (copy)
s.setf("%s/%s.tmp", folder, filename); // set (format)
s.setf("%s/%s.tmp", folder, filename); // set (w/format)
s.append("hello"); // append. cost a length() calculation!
s.appendf("hello %d", 42); // append formmated. cost a length() calculation!
s.appendf("hello %d", 42); // append (w/format). cost a length() calculation!
s.set_ref("Hey!"); // set (literal/reference, just copy pointer, no tracking)
Constructor helper for format string: add a trailing 'f' to the type. Underlying type is the same.
Str256f filename("%s/%s.tmp", folder, filename); // construct
fopen(Str256f("%s/%s.tmp, folder, filename).c_str(), "rb"); // construct, use as function param, destruct
Str256f filename("%s/%s.tmp", folder, filename); // construct (w/format)
fopen(Str256f("%s/%s.tmp, folder, filename).c_str(), "rb"); // construct (w/format), use as function param, destruct
Constructor helper for reference/literal:
Expand Down
10 changes: 5 additions & 5 deletions Str.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,20 @@ All StrXXX types derives from Str. So you can pass e.g. Str256* to a function ta
Str256 s;
s.set("hello sailor"); // set (copy)
s.setf("%s/%s.tmp", folder, filename); // set (format)
s.setf("%s/%s.tmp", folder, filename); // set (w/format)
s.append("hello"); // append. cost a length() calculation!
s.appendf("hello %d", 42); // append formmated. cost a length() calculation!
s.appendf("hello %d", 42); // append (w/format). cost a length() calculation!
s.set_ref("Hey!"); // set (literal/reference, just copy pointer, no tracking)
Constructor helper for format string: add a trailing 'f' to the type. Underlying type is the same.
Str256f filename("%s/%s.tmp", folder, filename); // construct
fopen(Str256f("%s/%s.tmp, folder, filename).c_str(), "rb"); // construct, use as function param, destruct
Str256f filename("%s/%s.tmp", folder, filename); // construct (w/format)
fopen(Str256f("%s/%s.tmp, folder, filename).c_str(), "rb"); // construct (w/format), use as function param, destruct
Constructor helper for reference/literal:
StrRef ref("literal"); // copy pointer, no allocation, no string copy
StrRef ref2(GetDebugName()); // copy pointer. no tracking of anything whatsoever, know what you are doing!
StrRef ref2(GetDebugName()); // copy pointer. no tracking of anything whatsoever, know what you are doing!
(Using a template e.g. Str<N> we could remove the LocalBufSize storage but it would make passing
typed Str<> to functions tricky. Instead we don't use template so you can pass them around as
Expand Down

0 comments on commit 0d8f130

Please sign in to comment.