ROSE  0.9.9.109
BinaryString.h
1 #ifndef ROSE_BinaryAnalysis_String_H
2 #define ROSE_BinaryAnalysis_String_H
3 
4 #include <MemoryMap.h>
5 #include <Sawyer/CommandLine.h>
6 #include <Sawyer/Optional.h>
7 
8 namespace Rose {
9 namespace BinaryAnalysis {
10 
163 namespace Strings {
164 
167 
168 typedef uint8_t Octet;
169 typedef std::vector<Octet> Octets;
170 typedef unsigned CodeValue;
171 typedef std::vector<CodeValue> CodeValues;
172 typedef unsigned CodePoint;
173 typedef std::vector<CodePoint> CodePoints;
176 class Exception: public std::runtime_error {
177 public:
178  Exception(const std::string &s): std::runtime_error(s) {}
179 };
180 
194 enum State {
195  FINAL_STATE = -1,
198  ERROR_STATE = -4,
203 };
204 
206 bool isDone(State st);
207 
209 void initDiagnostics();
210 
217 class ROSE_DLL_API CharacterEncodingForm: public Sawyer::SharedObject {
218 protected:
219  State state_;
220 public:
222  virtual ~CharacterEncodingForm() {}
223 
226 
228  virtual Ptr clone() const = 0;
229 
231  virtual std::string name() const = 0;
232 
236  virtual CodeValues encode(CodePoint) = 0;
237 
239  State state() const { return state_; }
240 
245  virtual State decode(CodeValue) = 0;
246 
250  virtual CodePoint consume() = 0;
251 
253  virtual void reset() = 0;
254 };
255 
260  CodePoint cp_;
261 protected:
262  NoopCharacterEncodingForm(): cp_(0) {}
263 public:
266 
267  static Ptr instance() { return Ptr(new NoopCharacterEncodingForm); }
268  virtual CharacterEncodingForm::Ptr clone() const ROSE_OVERRIDE { return Ptr(new NoopCharacterEncodingForm(*this)); }
269  virtual std::string name() const ROSE_OVERRIDE { return "no-op"; }
270  virtual CodeValues encode(CodePoint cp) ROSE_OVERRIDE;
271  virtual State decode(CodeValue) ROSE_OVERRIDE;
272  virtual CodePoint consume() ROSE_OVERRIDE;
273  virtual void reset() ROSE_OVERRIDE;
274 };
275 
278 
283  CodePoint cp_;
284 protected:
285  Utf8CharacterEncodingForm(): cp_(0) {}
286 public:
289 
290  static Ptr instance() { return Ptr(new Utf8CharacterEncodingForm); }
291  virtual CharacterEncodingForm::Ptr clone() const ROSE_OVERRIDE { return Ptr(new Utf8CharacterEncodingForm(*this)); }
292  virtual std::string name() const ROSE_OVERRIDE { return "UTF-8"; }
293  virtual CodeValues encode(CodePoint cp) ROSE_OVERRIDE;
294  virtual State decode(CodeValue) ROSE_OVERRIDE;
295  virtual CodePoint consume() ROSE_OVERRIDE;
296  virtual void reset() ROSE_OVERRIDE;
297 };
298 
301 
305 class ROSE_DLL_API Utf16CharacterEncodingForm: public CharacterEncodingForm {
306  CodePoint cp_;
307 protected:
308  Utf16CharacterEncodingForm(): cp_(0) {}
309 public:
312 
313  static Ptr instance() { return Ptr(new Utf16CharacterEncodingForm); }
314  virtual CharacterEncodingForm::Ptr clone() const ROSE_OVERRIDE { return Ptr(new Utf16CharacterEncodingForm(*this)); }
315  virtual std::string name() const ROSE_OVERRIDE { return "UTF-16"; }
316  virtual CodeValues encode(CodePoint cp) ROSE_OVERRIDE;
317  virtual State decode(CodeValue) ROSE_OVERRIDE;
318  virtual CodePoint consume() ROSE_OVERRIDE;
319  virtual void reset() ROSE_OVERRIDE;
320 };
321 
324 
330 class ROSE_DLL_API CharacterEncodingScheme: public Sawyer::SharedObject {
331 protected:
332  State state_;
333 public:
335  virtual ~CharacterEncodingScheme() {}
336 
339 
341  virtual Ptr clone() const = 0;
342 
344  virtual std::string name() const = 0;
345 
348  virtual Octets encode(CodeValue) = 0;
349 
351  State state() const { return state_; }
352 
357  virtual State decode(Octet) = 0;
358 
362  virtual CodeValue consume() = 0;
363 
365  virtual void reset() = 0;
366 };
367 
374  size_t octetsPerValue_;
375  ByteOrder::Endianness sex_;
376  CodeValue cv_;
377 protected:
378  BasicCharacterEncodingScheme(size_t octetsPerValue, ByteOrder::Endianness sex)
379  : octetsPerValue_(octetsPerValue), sex_(sex), cv_(0) {
380  ASSERT_require(1==octetsPerValue || sex!=ByteOrder::ORDER_UNSPECIFIED);
381  ASSERT_require(octetsPerValue <= sizeof(CodeValue));
382  }
383 public:
384  static Ptr instance(size_t octetsPerValue, ByteOrder::Endianness sex = ByteOrder::ORDER_UNSPECIFIED) {
385  return Ptr(new BasicCharacterEncodingScheme(octetsPerValue, sex));
386  }
387  virtual Ptr clone() const ROSE_OVERRIDE {
388  return Ptr(new BasicCharacterEncodingScheme(*this));
389  }
390  virtual std::string name() const ROSE_OVERRIDE;
391  virtual Octets encode(CodeValue) ROSE_OVERRIDE;
392  virtual State decode(Octet) ROSE_OVERRIDE;
393  virtual CodeValue consume() ROSE_OVERRIDE;
394  virtual void reset() ROSE_OVERRIDE;
395 };
396 
399  ByteOrder::Endianness sex = ByteOrder::ORDER_UNSPECIFIED);
400 
405 class ROSE_DLL_API LengthEncodingScheme: public Sawyer::SharedObject {
406 protected:
407  State state_;
408 public:
409  LengthEncodingScheme(): state_(INITIAL_STATE) {}
410  virtual ~LengthEncodingScheme() {}
411 
414 
416  virtual Ptr clone() const = 0;
417 
419  virtual std::string name() const = 0;
420 
422  virtual Octets encode(size_t) = 0;
423 
425  State state() const { return state_; }
426 
431  virtual State decode(Octet) = 0;
432 
436  virtual size_t consume() = 0;
437 
439  virtual void reset() = 0;
440 };
441 
448  size_t octetsPerValue_;
449  ByteOrder::Endianness sex_;
450  size_t length_;
451 protected:
452  BasicLengthEncodingScheme(size_t octetsPerValue, ByteOrder::Endianness sex)
453  : octetsPerValue_(octetsPerValue), sex_(sex), length_(0) {
454  ASSERT_require(1==octetsPerValue || sex!=ByteOrder::ORDER_UNSPECIFIED);
455  ASSERT_require(octetsPerValue <= sizeof(size_t));
456  }
457 public:
458  static Ptr instance(size_t octetsPerValue, ByteOrder::Endianness sex = ByteOrder::ORDER_UNSPECIFIED) {
459  return Ptr(new BasicLengthEncodingScheme(octetsPerValue, sex));
460  }
461  virtual Ptr clone() const ROSE_OVERRIDE {
462  return Ptr(new BasicLengthEncodingScheme(*this));
463  }
464  virtual std::string name() const ROSE_OVERRIDE;
465  virtual Octets encode(size_t) ROSE_OVERRIDE;
466  virtual State decode(Octet) ROSE_OVERRIDE;
467  virtual size_t consume() ROSE_OVERRIDE;
468  virtual void reset() ROSE_OVERRIDE;
469 };
470 
472 BasicLengthEncodingScheme::Ptr basicLengthEncodingScheme(size_t octetsPerValue,
473  ByteOrder::Endianness sex = ByteOrder::ORDER_UNSPECIFIED);
474 
478 class ROSE_DLL_API CodePointPredicate: public Sawyer::SharedObject {
479 public:
480  virtual ~CodePointPredicate() {}
481 
484 
486  virtual std::string name() const = 0;
487 
489  virtual bool isValid(CodePoint) = 0;
490 };
491 
496 class ROSE_DLL_API PrintableAscii: public CodePointPredicate {
497 protected:
498  PrintableAscii() {}
499 public:
500  static Ptr instance() {
501  return Ptr(new PrintableAscii);
502  }
503  virtual std::string name() const ROSE_OVERRIDE { return "printable ASCII"; }
504  virtual bool isValid(CodePoint) ROSE_OVERRIDE;
505 };
506 
509 
513 class ROSE_DLL_API AnyCodePoint: public CodePointPredicate {
514 protected:
515  AnyCodePoint() {}
516 public:
517  static Ptr instance() { return Ptr(new AnyCodePoint); }
518  virtual std::string name() const ROSE_OVERRIDE { return "any code point"; }
519  virtual bool isValid(CodePoint) ROSE_OVERRIDE { return true; }
520 };
521 
524 
529 class ROSE_DLL_API StringEncodingScheme: public Sawyer::SharedObject {
530 protected:
531  State state_; // decoding state
532  CodePoints codePoints_; // unconsumed code points
533  size_t nCodePoints_; // number of code points decoded since reset
537 
538 protected:
539  StringEncodingScheme(): state_(INITIAL_STATE), nCodePoints_(0) {}
540 
542  const CodePointPredicate::Ptr &cpp)
543  : cef_(cef), ces_(ces), cpp_(cpp) {}
544 
545 public:
546  virtual ~StringEncodingScheme() {}
547 
550 
552  virtual std::string name() const = 0;
553 
555  virtual Ptr clone() const = 0;
556 
558  virtual Octets encode(const CodePoints&) = 0;
559 
561  State state() const { return state_; }
562 
567  virtual State decode(Octet) = 0;
568 
575  CodePoints consume();
576 
578  const CodePoints& codePoints() const { return codePoints_; }
579 
581  size_t length() const { return nCodePoints_; }
582 
584  virtual void reset();
585 
595  void characterEncodingForm(const CharacterEncodingForm::Ptr &cef) { cef_ = cef; }
607  void characterEncodingScheme(const CharacterEncodingScheme::Ptr &ces) { ces_ = ces; }
618  void codePointPredicate(const CodePointPredicate::Ptr &cpp) { cpp_ = cpp; }
620 };
621 
625 class ROSE_DLL_API LengthEncodedString: public StringEncodingScheme {
627  Sawyer::Optional<size_t> declaredLength_; // decoded length
628 protected:
631  : StringEncodingScheme(cef, ces, cpp), les_(les) {}
632 public:
635 
636  static Ptr instance(const LengthEncodingScheme::Ptr &les, const CharacterEncodingForm::Ptr &cef,
637  const CharacterEncodingScheme::Ptr &ces, const CodePointPredicate::Ptr &cpp) {
638  return Ptr(new LengthEncodedString(les, cef, ces, cpp));
639  }
640  virtual StringEncodingScheme::Ptr clone() const ROSE_OVERRIDE {
641  LengthEncodingScheme::Ptr les = les_->clone();
642  CharacterEncodingForm::Ptr cef = cef_->clone();
643  CharacterEncodingScheme::Ptr ces = ces_->clone();
644  CodePointPredicate::Ptr cpp = cpp_; // not cloned since they have no state
645  LengthEncodedString *inst = new LengthEncodedString(les, cef, ces, cpp);
646  inst->state_ = state_;
647  inst->codePoints_ = codePoints_;
648  inst->nCodePoints_ = nCodePoints_;
649  inst->declaredLength_ = declaredLength_;
650  return Ptr(inst);
651  }
652  virtual std::string name() const ROSE_OVERRIDE;
653  virtual Octets encode(const CodePoints&) ROSE_OVERRIDE;
654  virtual State decode(Octet) ROSE_OVERRIDE;
655  virtual void reset() ROSE_OVERRIDE;
656 
662  Sawyer::Optional<size_t> declaredLength() const { return declaredLength_; }
663 
670  void lengthEncodingScheme(const LengthEncodingScheme::Ptr &les) { les_ = les; }
672 };
673 
677 
681  ByteOrder::Endianness order = ByteOrder::ORDER_UNSPECIFIED);
682 
684 LengthEncodedString::Ptr lengthEncodedPrintableAsciiWide(size_t lengthSize, ByteOrder::Endianness order, size_t charSize);
685 
690 class ROSE_DLL_API TerminatedString: public StringEncodingScheme {
691  CodePoints terminators_;
692  Sawyer::Optional<CodePoint> terminated_; // decoded termination
693 protected:
695  const CodePointPredicate::Ptr &cpp, const CodePoints &terminators)
696  : StringEncodingScheme(cef, ces, cpp), terminators_(terminators) {}
697 public:
700 
701  static Ptr instance(const CharacterEncodingForm::Ptr &cef, const CharacterEncodingScheme::Ptr &ces,
702  const CodePointPredicate::Ptr &cpp, const CodePoints &terminators) {
703  return Ptr(new TerminatedString(cef, ces, cpp, terminators));
704  }
705  static Ptr instance(const CharacterEncodingForm::Ptr &cef, const CharacterEncodingScheme::Ptr &ces,
706  const CodePointPredicate::Ptr &cpp, CodePoint terminator = 0) {
707  return Ptr(new TerminatedString(cef, ces, cpp, CodePoints(1, terminator)));
708  }
709  virtual StringEncodingScheme::Ptr clone() const ROSE_OVERRIDE {
710  CharacterEncodingForm::Ptr cef = cef_->clone();
711  CharacterEncodingScheme::Ptr ces = ces_->clone();
712  CodePointPredicate::Ptr cpp = cpp_; // not cloned since they have no state
713  TerminatedString *inst = new TerminatedString(cef, ces, cpp, terminators_);
714  inst->state_ = state_;
715  inst->codePoints_ = codePoints_;
716  inst->nCodePoints_ = nCodePoints_;
717  inst->terminated_ = terminated_;
718  return Ptr(inst);
719  }
720  virtual std::string name() const ROSE_OVERRIDE;
721  virtual Octets encode(const CodePoints&) ROSE_OVERRIDE;
722  virtual State decode(Octet) ROSE_OVERRIDE;
723  virtual void reset() ROSE_OVERRIDE;
724 
729  Sawyer::Optional<CodePoint> terminated() const { return terminated_; }
730 
738  const CodePoints& terminators() const { return terminators_; }
739  CodePoints& terminators() { return terminators_; }
741 };
742 
745 
747 TerminatedString::Ptr nulTerminatedPrintableAsciiWide(size_t charSize, ByteOrder::Endianness order);
748 
753 class ROSE_DLL_API EncodedString {
754  StringEncodingScheme::Ptr encoder_; // how string is encoded
755  AddressInterval where_; // where encoded string is located
756 public:
757  EncodedString() {}
758  EncodedString(const StringEncodingScheme::Ptr &encoder, const AddressInterval &where)
759  : encoder_(encoder), where_(where) {}
760 
762  StringEncodingScheme::Ptr encoder() const { return encoder_; }
763 
765  const AddressInterval& where() const { return where_; }
766 
768  rose_addr_t address() const { return where_.least(); }
769 
771  size_t size() const { return where_.size(); }
772 
774  size_t length() const { return encoder_->length(); }
775 
779  const CodePoints& codePoints() const { return encoder_->codePoints(); }
780 
784  std::string narrow() const;
785 
787  std::wstring wide() const;
788 
793  void decode(const MemoryMap&);
794 };
795 
802 class ROSE_DLL_API StringFinder {
803 public:
807  struct Settings {
812  size_t minLength;
813 
818  size_t maxLength;
819 
835  size_t maxOverlap;
836 
842 
843  Settings(): minLength(5), maxLength(-1), maxOverlap(8), keepingOnlyLongest(true) {}
844  };
845 
846 private:
847  Settings settings_; // command-line settings for this analysis
848  bool discardingCodePoints_; // whether to store decoded code points
849  std::vector<StringEncodingScheme::Ptr> encoders_; // encodings to use when searching
850  std::vector<EncodedString> strings_; // strings that have been found
851 
852 public:
857  StringFinder(): discardingCodePoints_(false) {}
858 
862  const Settings& settings() const { return settings_; }
863  Settings& settings() { return settings_; }
873  bool discardingCodePoints() const { return discardingCodePoints_; }
874  StringFinder& discardingCodePoints(bool b) { discardingCodePoints_=b; return *this; }
883  const std::vector<StringEncodingScheme::Ptr>& encoders() const { return encoders_; }
884  std::vector<StringEncodingScheme::Ptr>& encoders() { return encoders_; }
895  static Sawyer::CommandLine::SwitchGroup commandLineSwitches(Settings&);
896  Sawyer::CommandLine::SwitchGroup commandLineSwitches();
913  StringFinder& insertCommonEncoders(ByteOrder::Endianness);
914 
920  StringFinder& insertUncommonEncoders(ByteOrder::Endianness);
921 
925  StringFinder& reset() { strings_.clear(); return *this; }
926 
956 
960  const std::vector<EncodedString>& strings() const { return strings_; }
961  std::vector<EncodedString>& strings() { return strings_; }
967  std::ostream& print(std::ostream&) const;
968 };
969 
970 std::ostream& operator<<(std::ostream&, const StringFinder&);
971 
972 } // namespace
973 } // namespace
974 } // namespace
975 
976 #endif
PrintableAscii::Ptr printableAscii()
Returns a new printable ASCII predicate.
unsigned MatchFlags
Flags for matching constraints.
Definition: AddressMap.h:46
CodePointPredicate::Ptr codePointPredicate() const
Property: Code point predicate.
Definition: BinaryString.h:617
virtual CharacterEncodingForm::Ptr clone() const ROSE_OVERRIDE
Create a new encoder from this one.
Definition: BinaryString.h:314
size_t length() const
Number of code points decoded since reset.
Definition: BinaryString.h:581
void characterEncodingScheme(const CharacterEncodingScheme::Ptr &ces)
Property: Character encoding scheme.
Definition: BinaryString.h:607
virtual CharacterEncodingForm::Ptr clone() const ROSE_OVERRIDE
Create a new encoder from this one.
Definition: BinaryString.h:291
virtual Ptr clone() const ROSE_OVERRIDE
Create a new copy of this encoder.
Definition: BinaryString.h:461
Value size() const
Size of interval.
Definition: Interval.h:257
std::vector< CodePoint > CodePoints
A sequence of code points, i.e., a string.
Definition: BinaryString.h:173
LengthEncodedString::Ptr lengthEncodedPrintableAsciiWide(size_t lengthSize, ByteOrder::Endianness order, size_t charSize)
Returns a new encoder for multi-byte length-encoded printable ASCII strings.
size_t maxOverlap
Whether to allow overlapping strings.
Definition: BinaryString.h:835
Sawyer::SharedPointer< Utf16CharacterEncodingForm > Ptr
Shared-ownership pointer to a Utf16CharacterEncodingForm.
Definition: BinaryString.h:311
Settings & settings()
Property: Analysis settings often set from a command-line.
Definition: BinaryString.h:863
Defines the mapping between code values and octets.
Definition: BinaryString.h:330
size_t minLength
Minimum length of matched strings.
Definition: BinaryString.h:812
Collection of streams.
Definition: Message.h:1579
BasicLengthEncodingScheme::Ptr basicLengthEncodingScheme(size_t octetsPerValue, ByteOrder::Endianness sex=ByteOrder::ORDER_UNSPECIFIED)
Returns a new basic length encoding scheme.
void codePointPredicate(const CodePointPredicate::Ptr &cpp)
Property: Code point predicate.
Definition: BinaryString.h:618
void initDiagnostics()
Initialize the diagnostics facility.
const AddressInterval & where() const
Where the string is located in memory.
Definition: BinaryString.h:765
const Settings & settings() const
Property: Analysis settings often set from a command-line.
Definition: BinaryString.h:862
LengthEncodingScheme::Ptr lengthEncodingScheme() const
Property: Lengh encoding scheme.
Definition: BinaryString.h:669
Initial state just after a reset.
Definition: BinaryString.h:197
Terminated string encoding scheme.
Definition: BinaryString.h:690
Sawyer::SharedPointer< TerminatedString > Ptr
Shared ownership pointer to a TerminatedString.
Definition: BinaryString.h:699
const CodePoints & terminators() const
Property: string termination code points.
Definition: BinaryString.h:738
A collection of related switch declarations.
Definition: CommandLine.h:2488
const CodePoints & codePoints() const
Return pending decoded code points without consuming them.
Definition: BinaryString.h:578
Analysis to find encoded strings.
Definition: BinaryString.h:802
unsigned CodePoint
One character in a coded character set.
Definition: BinaryString.h:172
bool keepingOnlyLongest
Whether to keep only longest non-overlapping strings.
Definition: BinaryString.h:841
Main namespace for the ROSE library.
BasicCharacterEncodingScheme::Ptr basicCharacterEncodingScheme(size_t octetsPerValue, ByteOrder::Endianness sex=ByteOrder::ORDER_UNSPECIFIED)
Returns a new basic character encoding scheme.
Sawyer::SharedPointer< CharacterEncodingScheme > Ptr
Shared ownership pointer to a CharacterEncodingScheme.
Definition: BinaryString.h:338
Sawyer::SharedPointer< CharacterEncodingForm > Ptr
Shared ownership pointer to a CharacterEncodingForm.
Definition: BinaryString.h:225
const std::vector< StringEncodingScheme::Ptr > & encoders() const
Property: List of string encodings.
Definition: BinaryString.h:883
virtual std::string name() const ROSE_OVERRIDE
Name of encoder.
Definition: BinaryString.h:292
StringFinder & reset()
Reset analysis results.
Definition: BinaryString.h:925
unsigned CodeValue
One value in a sequence that encodes a code point.
Definition: BinaryString.h:170
Name space for the entire library.
Definition: Access.h:11
Sawyer::Message::Facility mlog
Diagnostics specific to string analysis.
std::vector< Octet > Octets
A sequence of octets.
Definition: BinaryString.h:169
Sawyer::SharedPointer< NoopCharacterEncodingForm > Ptr
Shared-ownership pointer to a NoopCharacterEncodingFormat.
Definition: BinaryString.h:265
size_t size() const
Size of encoded string in bytes.
Definition: BinaryString.h:771
virtual bool isValid(CodePoint) ROSE_OVERRIDE
Predicate.
Definition: BinaryString.h:519
StringFinder & discardingCodePoints(bool b)
Property: Whether to discard code points.
Definition: BinaryString.h:874
uint8_t Octet
One byte in a sequence that encodes a code value.
Definition: BinaryString.h:168
std::vector< CodeValue > CodeValues
A sequence of code values.
Definition: BinaryString.h:171
T least() const
Returns lower limit.
Definition: Interval.h:185
bool discardingCodePoints() const
Property: Whether to discard code points.
Definition: BinaryString.h:873
std::vector< EncodedString > & strings()
Obtain strings that were found.
Definition: BinaryString.h:961
size_t maxLength
Maximum length of matched strings.
Definition: BinaryString.h:818
Final state where nothing more can be decoded.
Definition: BinaryString.h:195
const std::vector< EncodedString > & strings() const
Obtain strings that were found.
Definition: BinaryString.h:960
Encoding for the length of a string.
Definition: BinaryString.h:405
void characterEncodingForm(const CharacterEncodingForm::Ptr &cef)
Property: Character encoding format.
Definition: BinaryString.h:595
An efficient mapping from an address space to stored data.
Definition: MemoryMap.h:96
Defines mapping between code points and code values.
Definition: BinaryString.h:217
virtual StringEncodingScheme::Ptr clone() const ROSE_OVERRIDE
Create a new copy of this encoder.
Definition: BinaryString.h:709
const CodePoints & codePoints() const
Code points associated with the string.
Definition: BinaryString.h:779
AnyCodePoint::Ptr anyCodePoint()
Returns a new predicate that matches all code points.
Completed state, but not a final state.
Definition: BinaryString.h:196
virtual StringEncodingScheme::Ptr clone() const ROSE_OVERRIDE
Create a new copy of this encoder.
Definition: BinaryString.h:640
Sawyer::SharedPointer< StringEncodingScheme > Ptr
Shared ownership pointer to a StringEncodingScheme.
Definition: BinaryString.h:549
TerminatedString::Ptr nulTerminatedPrintableAscii()
Returns a new encoder for NUL-terminated printable ASCII strings.
Constraints are used to select addresses from a memory map.
Definition: AddressMap.h:76
LengthEncodedString::Ptr lengthEncodedString(const LengthEncodingScheme::Ptr &les, const CharacterEncodingForm::Ptr &cef, const CharacterEncodingScheme::Ptr &ces, const CodePointPredicate::Ptr &cpp)
Returns a new length-prefixed string encoder.
CharacterEncodingScheme::Ptr characterEncodingScheme() const
Property: Character encoding scheme.
Definition: BinaryString.h:606
virtual std::string name() const ROSE_OVERRIDE
Name of encoder.
Definition: BinaryString.h:269
NoopCharacterEncodingForm::Ptr noopCharacterEncodingForm()
Returns a new no-op character encoding form.
size_t length() const
Length of encoded string in code points.
Definition: BinaryString.h:774
LengthEncodedString::Ptr lengthEncodedPrintableAscii(size_t lengthSize, ByteOrder::Endianness order=ByteOrder::ORDER_UNSPECIFIED)
Returns a new encoder for length-encoded printable ASCII strings.
Sawyer::SharedPointer< LengthEncodingScheme > Ptr
Shared ownership pointer to a LengthEncodingScheme.
Definition: BinaryString.h:413
Sawyer::SharedPointer< CodePointPredicate > Ptr
Shared ownership pointer to a CodePointPredicate.
Definition: BinaryString.h:483
Base class for reference counted objects.
Definition: SharedObject.h:22
virtual CharacterEncodingForm::Ptr clone() const ROSE_OVERRIDE
Create a new encoder from this one.
Definition: BinaryString.h:268
virtual std::string name() const ROSE_OVERRIDE
Name of encoder.
Definition: BinaryString.h:315
TerminatedString::Ptr nulTerminatedPrintableAsciiWide(size_t charSize, ByteOrder::Endianness order)
Returns a new encoder for multi-byte NUL-terminated printable ASCII strings.
rose_addr_t address() const
Starting address of string in memory.
Definition: BinaryString.h:768
CharacterEncodingForm::Ptr characterEncodingForm() const
Property: Character encoding format.
Definition: BinaryString.h:594
Errors for string analysis.
Definition: BinaryString.h:176
Sawyer::SharedPointer< LengthEncodedString > Ptr
Shared ownership pointer to a LengthEncodedString.
Definition: BinaryString.h:634
CodePoints & terminators()
Property: string termination code points.
Definition: BinaryString.h:739
void lengthEncodingScheme(const LengthEncodingScheme::Ptr &les)
Property: Lengh encoding scheme.
Definition: BinaryString.h:670
Sawyer::SharedPointer< Utf8CharacterEncodingForm > Ptr
Shared-ownership pointer to a Utf8CharacterEncodingForm.
Definition: BinaryString.h:288
Utf8CharacterEncodingForm::Ptr utf8CharacterEncodingForm()
Returns a new UTF-8 character encoding form.
Decoder is in an error condition.
Definition: BinaryString.h:198
Length-prefixed string encoding scheme.
Definition: BinaryString.h:625
std::vector< StringEncodingScheme::Ptr > & encoders()
Property: List of string encodings.
Definition: BinaryString.h:884
virtual std::string name() const ROSE_OVERRIDE
Name of predicate.
Definition: BinaryString.h:503
virtual std::string name() const ROSE_OVERRIDE
Name of predicate.
Definition: BinaryString.h:518
virtual Ptr clone() const ROSE_OVERRIDE
Create a new copy of this encoder.
Definition: BinaryString.h:387
bool isDone(State st)
Returns true for COMPLETED_STATE or FINAL_STATE.
Utf16CharacterEncodingForm::Ptr utf16CharacterEncodingForm()
Returns a new UTF-16 character encoding form.
StringEncodingScheme::Ptr encoder() const
Information about the string encoding.
Definition: BinaryString.h:762