ROSE  0.10.13.0
BinaryString.h
1 #ifndef ROSE_BinaryAnalysis_String_H
2 #define ROSE_BinaryAnalysis_String_H
3 #include <rosePublicConfig.h>
4 #ifdef ROSE_BUILD_BINARY_ANALYSIS_SUPPORT
5 
6 #include <Diagnostics.h>
7 #include <MemoryMap.h>
8 #include <RoseException.h>
9 #include <Sawyer/CommandLine.h>
10 #include <Sawyer/Optional.h>
11 
12 namespace Rose {
13 namespace BinaryAnalysis {
14 
167 namespace Strings {
168 
171 
172 typedef uint8_t Octet;
173 typedef std::vector<Octet> Octets;
174 typedef unsigned CodeValue;
175 typedef std::vector<CodeValue> CodeValues;
176 typedef unsigned CodePoint;
177 typedef std::vector<CodePoint> CodePoints;
180 class Exception: public Rose::Exception {
181 public:
182  Exception(const std::string &s): Rose::Exception(s) {}
183 };
184 
198 enum State {
199  FINAL_STATE = -1,
202  ERROR_STATE = -4,
207 };
208 
210 bool isDone(State st);
211 
213 void initDiagnostics();
214 
221 class ROSE_DLL_API CharacterEncodingForm: public Sawyer::SharedObject {
222 protected:
223  State state_;
224 public:
226  virtual ~CharacterEncodingForm() {}
227 
230 
232  virtual Ptr clone() const = 0;
233 
235  virtual std::string name() const = 0;
236 
240  virtual CodeValues encode(CodePoint) = 0;
241 
243  State state() const { return state_; }
244 
249  virtual State decode(CodeValue) = 0;
250 
254  virtual CodePoint consume() = 0;
255 
257  virtual void reset() = 0;
258 };
259 
264  CodePoint cp_;
265 protected:
266  NoopCharacterEncodingForm(): cp_(0) {}
267 public:
270 
271  static Ptr instance() { return Ptr(new NoopCharacterEncodingForm); }
272  virtual CharacterEncodingForm::Ptr clone() const ROSE_OVERRIDE { return Ptr(new NoopCharacterEncodingForm(*this)); }
273  virtual std::string name() const ROSE_OVERRIDE { return "no-op"; }
274  virtual CodeValues encode(CodePoint cp) ROSE_OVERRIDE;
275  virtual State decode(CodeValue) ROSE_OVERRIDE;
276  virtual CodePoint consume() ROSE_OVERRIDE;
277  virtual void reset() ROSE_OVERRIDE;
278 };
279 
282 
287  CodePoint cp_;
288 protected:
289  Utf8CharacterEncodingForm(): cp_(0) {}
290 public:
293 
294  static Ptr instance() { return Ptr(new Utf8CharacterEncodingForm); }
295  virtual CharacterEncodingForm::Ptr clone() const ROSE_OVERRIDE { return Ptr(new Utf8CharacterEncodingForm(*this)); }
296  virtual std::string name() const ROSE_OVERRIDE { return "UTF-8"; }
297  virtual CodeValues encode(CodePoint cp) ROSE_OVERRIDE;
298  virtual State decode(CodeValue) ROSE_OVERRIDE;
299  virtual CodePoint consume() ROSE_OVERRIDE;
300  virtual void reset() ROSE_OVERRIDE;
301 };
302 
305 
309 class ROSE_DLL_API Utf16CharacterEncodingForm: public CharacterEncodingForm {
310  CodePoint cp_;
311 protected:
312  Utf16CharacterEncodingForm(): cp_(0) {}
313 public:
316 
317  static Ptr instance() { return Ptr(new Utf16CharacterEncodingForm); }
318  virtual CharacterEncodingForm::Ptr clone() const ROSE_OVERRIDE { return Ptr(new Utf16CharacterEncodingForm(*this)); }
319  virtual std::string name() const ROSE_OVERRIDE { return "UTF-16"; }
320  virtual CodeValues encode(CodePoint cp) ROSE_OVERRIDE;
321  virtual State decode(CodeValue) ROSE_OVERRIDE;
322  virtual CodePoint consume() ROSE_OVERRIDE;
323  virtual void reset() ROSE_OVERRIDE;
324 };
325 
328 
334 class ROSE_DLL_API CharacterEncodingScheme: public Sawyer::SharedObject {
335 protected:
336  State state_;
337 public:
339  virtual ~CharacterEncodingScheme() {}
340 
343 
345  virtual Ptr clone() const = 0;
346 
348  virtual std::string name() const = 0;
349 
352  virtual Octets encode(CodeValue) = 0;
353 
355  State state() const { return state_; }
356 
361  virtual State decode(Octet) = 0;
362 
366  virtual CodeValue consume() = 0;
367 
369  virtual void reset() = 0;
370 };
371 
378  size_t octetsPerValue_;
379  ByteOrder::Endianness sex_;
380  CodeValue cv_;
381 protected:
382  BasicCharacterEncodingScheme(size_t octetsPerValue, ByteOrder::Endianness sex)
383  : octetsPerValue_(octetsPerValue), sex_(sex), cv_(0) {
384  ASSERT_require(1==octetsPerValue || sex!=ByteOrder::ORDER_UNSPECIFIED);
385  ASSERT_require(octetsPerValue <= sizeof(CodeValue));
386  }
387 public:
388  static Ptr instance(size_t octetsPerValue, ByteOrder::Endianness sex = ByteOrder::ORDER_UNSPECIFIED) {
389  return Ptr(new BasicCharacterEncodingScheme(octetsPerValue, sex));
390  }
391  virtual Ptr clone() const ROSE_OVERRIDE {
392  return Ptr(new BasicCharacterEncodingScheme(*this));
393  }
394  virtual std::string name() const ROSE_OVERRIDE;
395  virtual Octets encode(CodeValue) ROSE_OVERRIDE;
396  virtual State decode(Octet) ROSE_OVERRIDE;
397  virtual CodeValue consume() ROSE_OVERRIDE;
398  virtual void reset() ROSE_OVERRIDE;
399 };
400 
403  ByteOrder::Endianness sex = ByteOrder::ORDER_UNSPECIFIED);
404 
409 class ROSE_DLL_API LengthEncodingScheme: public Sawyer::SharedObject {
410 protected:
411  State state_;
412 public:
413  LengthEncodingScheme(): state_(INITIAL_STATE) {}
414  virtual ~LengthEncodingScheme() {}
415 
418 
420  virtual Ptr clone() const = 0;
421 
423  virtual std::string name() const = 0;
424 
426  virtual Octets encode(size_t) = 0;
427 
429  State state() const { return state_; }
430 
435  virtual State decode(Octet) = 0;
436 
440  virtual size_t consume() = 0;
441 
443  virtual void reset() = 0;
444 };
445 
452  size_t octetsPerValue_;
453  ByteOrder::Endianness sex_;
454  size_t length_;
455 protected:
456  BasicLengthEncodingScheme(size_t octetsPerValue, ByteOrder::Endianness sex)
457  : octetsPerValue_(octetsPerValue), sex_(sex), length_(0) {
458  ASSERT_require(1==octetsPerValue || sex!=ByteOrder::ORDER_UNSPECIFIED);
459  ASSERT_require(octetsPerValue <= sizeof(size_t));
460  }
461 public:
462  static Ptr instance(size_t octetsPerValue, ByteOrder::Endianness sex = ByteOrder::ORDER_UNSPECIFIED) {
463  return Ptr(new BasicLengthEncodingScheme(octetsPerValue, sex));
464  }
465  virtual Ptr clone() const ROSE_OVERRIDE {
466  return Ptr(new BasicLengthEncodingScheme(*this));
467  }
468  virtual std::string name() const ROSE_OVERRIDE;
469  virtual Octets encode(size_t) ROSE_OVERRIDE;
470  virtual State decode(Octet) ROSE_OVERRIDE;
471  virtual size_t consume() ROSE_OVERRIDE;
472  virtual void reset() ROSE_OVERRIDE;
473 };
474 
476 BasicLengthEncodingScheme::Ptr basicLengthEncodingScheme(size_t octetsPerValue,
477  ByteOrder::Endianness sex = ByteOrder::ORDER_UNSPECIFIED);
478 
482 class ROSE_DLL_API CodePointPredicate: public Sawyer::SharedObject {
483 public:
484  virtual ~CodePointPredicate() {}
485 
488 
490  virtual std::string name() const = 0;
491 
493  virtual bool isValid(CodePoint) = 0;
494 };
495 
500 class ROSE_DLL_API PrintableAscii: public CodePointPredicate {
501 protected:
502  PrintableAscii() {}
503 public:
504  static Ptr instance() {
505  return Ptr(new PrintableAscii);
506  }
507  virtual std::string name() const ROSE_OVERRIDE { return "printable ASCII"; }
508  virtual bool isValid(CodePoint) ROSE_OVERRIDE;
509 };
510 
513 
517 class ROSE_DLL_API AnyCodePoint: public CodePointPredicate {
518 protected:
519  AnyCodePoint() {}
520 public:
521  static Ptr instance() { return Ptr(new AnyCodePoint); }
522  virtual std::string name() const ROSE_OVERRIDE { return "any code point"; }
523  virtual bool isValid(CodePoint) ROSE_OVERRIDE { return true; }
524 };
525 
528 
533 class ROSE_DLL_API StringEncodingScheme: public Sawyer::SharedObject {
534 protected:
535  State state_; // decoding state
536  CodePoints codePoints_; // unconsumed code points
537  size_t nCodePoints_; // number of code points decoded since reset
541 
542 protected:
543  StringEncodingScheme(): state_(INITIAL_STATE), nCodePoints_(0) {}
544 
546  const CodePointPredicate::Ptr &cpp)
547  : cef_(cef), ces_(ces), cpp_(cpp) {}
548 
549 public:
550  virtual ~StringEncodingScheme() {}
551 
554 
556  virtual std::string name() const = 0;
557 
559  virtual Ptr clone() const = 0;
560 
562  virtual Octets encode(const CodePoints&) = 0;
563 
565  State state() const { return state_; }
566 
571  virtual State decode(Octet) = 0;
572 
579  CodePoints consume();
580 
582  const CodePoints& codePoints() const { return codePoints_; }
583 
585  size_t length() const { return nCodePoints_; }
586 
588  virtual void reset();
589 
599  void characterEncodingForm(const CharacterEncodingForm::Ptr &cef) { cef_ = cef; }
611  void characterEncodingScheme(const CharacterEncodingScheme::Ptr &ces) { ces_ = ces; }
622  void codePointPredicate(const CodePointPredicate::Ptr &cpp) { cpp_ = cpp; }
624 };
625 
629 class ROSE_DLL_API LengthEncodedString: public StringEncodingScheme {
631  Sawyer::Optional<size_t> declaredLength_; // decoded length
632 protected:
635  : StringEncodingScheme(cef, ces, cpp), les_(les) {}
636 public:
639 
640  static Ptr instance(const LengthEncodingScheme::Ptr &les, const CharacterEncodingForm::Ptr &cef,
641  const CharacterEncodingScheme::Ptr &ces, const CodePointPredicate::Ptr &cpp) {
642  return Ptr(new LengthEncodedString(les, cef, ces, cpp));
643  }
644  virtual StringEncodingScheme::Ptr clone() const ROSE_OVERRIDE {
645  LengthEncodingScheme::Ptr les = les_->clone();
646  CharacterEncodingForm::Ptr cef = cef_->clone();
647  CharacterEncodingScheme::Ptr ces = ces_->clone();
648  CodePointPredicate::Ptr cpp = cpp_; // not cloned since they have no state
649  LengthEncodedString *inst = new LengthEncodedString(les, cef, ces, cpp);
650  inst->state_ = state_;
651  inst->codePoints_ = codePoints_;
652  inst->nCodePoints_ = nCodePoints_;
653  inst->declaredLength_ = declaredLength_;
654  return Ptr(inst);
655  }
656  virtual std::string name() const ROSE_OVERRIDE;
657  virtual Octets encode(const CodePoints&) ROSE_OVERRIDE;
658  virtual State decode(Octet) ROSE_OVERRIDE;
659  virtual void reset() ROSE_OVERRIDE;
660 
666  Sawyer::Optional<size_t> declaredLength() const { return declaredLength_; }
667 
674  void lengthEncodingScheme(const LengthEncodingScheme::Ptr &les) { les_ = les; }
676 };
677 
681 
685  ByteOrder::Endianness order = ByteOrder::ORDER_UNSPECIFIED);
686 
688 LengthEncodedString::Ptr lengthEncodedPrintableAsciiWide(size_t lengthSize, ByteOrder::Endianness order, size_t charSize);
689 
694 class ROSE_DLL_API TerminatedString: public StringEncodingScheme {
695  CodePoints terminators_;
696  Sawyer::Optional<CodePoint> terminated_; // decoded termination
697 protected:
699  const CodePointPredicate::Ptr &cpp, const CodePoints &terminators)
700  : StringEncodingScheme(cef, ces, cpp), terminators_(terminators) {}
701 public:
704 
705  static Ptr instance(const CharacterEncodingForm::Ptr &cef, const CharacterEncodingScheme::Ptr &ces,
706  const CodePointPredicate::Ptr &cpp, const CodePoints &terminators) {
707  return Ptr(new TerminatedString(cef, ces, cpp, terminators));
708  }
709  static Ptr instance(const CharacterEncodingForm::Ptr &cef, const CharacterEncodingScheme::Ptr &ces,
710  const CodePointPredicate::Ptr &cpp, CodePoint terminator = 0) {
711  return Ptr(new TerminatedString(cef, ces, cpp, CodePoints(1, terminator)));
712  }
713  virtual StringEncodingScheme::Ptr clone() const ROSE_OVERRIDE {
714  CharacterEncodingForm::Ptr cef = cef_->clone();
715  CharacterEncodingScheme::Ptr ces = ces_->clone();
716  CodePointPredicate::Ptr cpp = cpp_; // not cloned since they have no state
717  TerminatedString *inst = new TerminatedString(cef, ces, cpp, terminators_);
718  inst->state_ = state_;
719  inst->codePoints_ = codePoints_;
720  inst->nCodePoints_ = nCodePoints_;
721  inst->terminated_ = terminated_;
722  return Ptr(inst);
723  }
724  virtual std::string name() const ROSE_OVERRIDE;
725  virtual Octets encode(const CodePoints&) ROSE_OVERRIDE;
726  virtual State decode(Octet) ROSE_OVERRIDE;
727  virtual void reset() ROSE_OVERRIDE;
728 
733  Sawyer::Optional<CodePoint> terminated() const { return terminated_; }
734 
742  const CodePoints& terminators() const { return terminators_; }
743  CodePoints& terminators() { return terminators_; }
745 };
746 
749 
751 TerminatedString::Ptr nulTerminatedPrintableAsciiWide(size_t charSize, ByteOrder::Endianness order);
752 
757 class ROSE_DLL_API EncodedString {
758  StringEncodingScheme::Ptr encoder_; // how string is encoded
759  AddressInterval where_; // where encoded string is located
760 public:
761  EncodedString() {}
762  EncodedString(const StringEncodingScheme::Ptr &encoder, const AddressInterval &where)
763  : encoder_(encoder), where_(where) {}
764 
766  StringEncodingScheme::Ptr encoder() const { return encoder_; }
767 
769  const AddressInterval& where() const { return where_; }
770 
772  rose_addr_t address() const { return where_.least(); }
773 
775  size_t size() const { return where_.size(); }
776 
778  size_t length() const { return encoder_->length(); }
779 
783  const CodePoints& codePoints() const { return encoder_->codePoints(); }
784 
788  std::string narrow() const;
789 
791  std::wstring wide() const;
792 
797  void decode(const MemoryMap&);
798 };
799 
806 class ROSE_DLL_API StringFinder {
807 public:
811  struct Settings {
816  size_t minLength;
817 
822  size_t maxLength;
823 
839  size_t maxOverlap;
840 
846 
847  Settings(): minLength(5), maxLength(-1), maxOverlap(8), keepingOnlyLongest(true) {}
848  };
849 
850 private:
851  Settings settings_; // command-line settings for this analysis
852  bool discardingCodePoints_; // whether to store decoded code points
853  std::vector<StringEncodingScheme::Ptr> encoders_; // encodings to use when searching
854  std::vector<EncodedString> strings_; // strings that have been found
855 
856 public:
861  StringFinder(): discardingCodePoints_(false) {}
862 
866  const Settings& settings() const { return settings_; }
867  Settings& settings() { return settings_; }
877  bool discardingCodePoints() const { return discardingCodePoints_; }
878  StringFinder& discardingCodePoints(bool b) { discardingCodePoints_=b; return *this; }
887  const std::vector<StringEncodingScheme::Ptr>& encoders() const { return encoders_; }
888  std::vector<StringEncodingScheme::Ptr>& encoders() { return encoders_; }
899  static Sawyer::CommandLine::SwitchGroup commandLineSwitches(Settings&);
900  Sawyer::CommandLine::SwitchGroup commandLineSwitches();
917  StringFinder& insertCommonEncoders(ByteOrder::Endianness);
918 
924  StringFinder& insertUncommonEncoders(ByteOrder::Endianness);
925 
929  StringFinder& reset() { strings_.clear(); return *this; }
930 
960 
964  const std::vector<EncodedString>& strings() const { return strings_; }
965  std::vector<EncodedString>& strings() { return strings_; }
971  std::ostream& print(std::ostream&) const;
972 };
973 
974 std::ostream& operator<<(std::ostream&, const StringFinder&);
975 
976 } // namespace
977 } // namespace
978 } // namespace
979 
980 #endif
981 #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:621
virtual CharacterEncodingForm::Ptr clone() const ROSE_OVERRIDE
Create a new encoder from this one.
Definition: BinaryString.h:318
size_t length() const
Number of code points decoded since reset.
Definition: BinaryString.h:585
void characterEncodingScheme(const CharacterEncodingScheme::Ptr &ces)
Property: Character encoding scheme.
Definition: BinaryString.h:611
virtual CharacterEncodingForm::Ptr clone() const ROSE_OVERRIDE
Create a new encoder from this one.
Definition: BinaryString.h:295
virtual Ptr clone() const ROSE_OVERRIDE
Create a new copy of this encoder.
Definition: BinaryString.h:465
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:177
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:839
Sawyer::SharedPointer< Utf16CharacterEncodingForm > Ptr
Shared-ownership pointer to a Utf16CharacterEncodingForm.
Definition: BinaryString.h:315
Settings & settings()
Property: Analysis settings often set from a command-line.
Definition: BinaryString.h:867
Defines the mapping between code values and octets.
Definition: BinaryString.h:334
size_t minLength
Minimum length of matched strings.
Definition: BinaryString.h:816
Collection of streams.
Definition: Message.h:1599
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:622
void initDiagnostics()
Initialize the diagnostics facility.
const AddressInterval & where() const
Where the string is located in memory.
Definition: BinaryString.h:769
const Settings & settings() const
Property: Analysis settings often set from a command-line.
Definition: BinaryString.h:866
LengthEncodingScheme::Ptr lengthEncodingScheme() const
Property: Lengh encoding scheme.
Definition: BinaryString.h:673
Initial state just after a reset.
Definition: BinaryString.h:201
Terminated string encoding scheme.
Definition: BinaryString.h:694
Sawyer::SharedPointer< TerminatedString > Ptr
Shared ownership pointer to a TerminatedString.
Definition: BinaryString.h:703
const CodePoints & terminators() const
Property: string termination code points.
Definition: BinaryString.h:742
A collection of related switch declarations.
const CodePoints & codePoints() const
Return pending decoded code points without consuming them.
Definition: BinaryString.h:582
Analysis to find encoded strings.
Definition: BinaryString.h:806
unsigned CodePoint
One character in a coded character set.
Definition: BinaryString.h:176
bool keepingOnlyLongest
Whether to keep only longest non-overlapping strings.
Definition: BinaryString.h:845
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:342
Sawyer::SharedPointer< CharacterEncodingForm > Ptr
Shared ownership pointer to a CharacterEncodingForm.
Definition: BinaryString.h:229
const std::vector< StringEncodingScheme::Ptr > & encoders() const
Property: List of string encodings.
Definition: BinaryString.h:887
virtual std::string name() const ROSE_OVERRIDE
Name of encoder.
Definition: BinaryString.h:296
StringFinder & reset()
Reset analysis results.
Definition: BinaryString.h:929
unsigned CodeValue
One value in a sequence that encodes a code point.
Definition: BinaryString.h:174
Name space for the entire library.
Sawyer::Message::Facility mlog
Diagnostics specific to string analysis.
std::vector< Octet > Octets
A sequence of octets.
Definition: BinaryString.h:173
Sawyer::SharedPointer< NoopCharacterEncodingForm > Ptr
Shared-ownership pointer to a NoopCharacterEncodingFormat.
Definition: BinaryString.h:269
size_t size() const
Size of encoded string in bytes.
Definition: BinaryString.h:775
virtual bool isValid(CodePoint) ROSE_OVERRIDE
Predicate.
Definition: BinaryString.h:523
StringFinder & discardingCodePoints(bool b)
Property: Whether to discard code points.
Definition: BinaryString.h:878
uint8_t Octet
One byte in a sequence that encodes a code value.
Definition: BinaryString.h:172
std::vector< CodeValue > CodeValues
A sequence of code values.
Definition: BinaryString.h:175
T least() const
Returns lower limit.
Definition: Interval.h:185
bool discardingCodePoints() const
Property: Whether to discard code points.
Definition: BinaryString.h:877
std::vector< EncodedString > & strings()
Obtain strings that were found.
Definition: BinaryString.h:965
size_t maxLength
Maximum length of matched strings.
Definition: BinaryString.h:822
Final state where nothing more can be decoded.
Definition: BinaryString.h:199
const std::vector< EncodedString > & strings() const
Obtain strings that were found.
Definition: BinaryString.h:964
Encoding for the length of a string.
Definition: BinaryString.h:409
void characterEncodingForm(const CharacterEncodingForm::Ptr &cef)
Property: Character encoding format.
Definition: BinaryString.h:599
An efficient mapping from an address space to stored data.
Definition: MemoryMap.h:112
Defines mapping between code points and code values.
Definition: BinaryString.h:221
virtual StringEncodingScheme::Ptr clone() const ROSE_OVERRIDE
Create a new copy of this encoder.
Definition: BinaryString.h:713
const CodePoints & codePoints() const
Code points associated with the string.
Definition: BinaryString.h:783
AnyCodePoint::Ptr anyCodePoint()
Returns a new predicate that matches all code points.
Completed state, but not a final state.
Definition: BinaryString.h:200
virtual StringEncodingScheme::Ptr clone() const ROSE_OVERRIDE
Create a new copy of this encoder.
Definition: BinaryString.h:644
Sawyer::SharedPointer< StringEncodingScheme > Ptr
Shared ownership pointer to a StringEncodingScheme.
Definition: BinaryString.h:553
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:610
virtual std::string name() const ROSE_OVERRIDE
Name of encoder.
Definition: BinaryString.h:273
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:778
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:417
Sawyer::SharedPointer< CodePointPredicate > Ptr
Shared ownership pointer to a CodePointPredicate.
Definition: BinaryString.h:487
Base class for reference counted objects.
Definition: SharedObject.h:64
virtual CharacterEncodingForm::Ptr clone() const ROSE_OVERRIDE
Create a new encoder from this one.
Definition: BinaryString.h:272
virtual std::string name() const ROSE_OVERRIDE
Name of encoder.
Definition: BinaryString.h:319
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:772
CharacterEncodingForm::Ptr characterEncodingForm() const
Property: Character encoding format.
Definition: BinaryString.h:598
Errors for string analysis.
Definition: BinaryString.h:180
Sawyer::SharedPointer< LengthEncodedString > Ptr
Shared ownership pointer to a LengthEncodedString.
Definition: BinaryString.h:638
CodePoints & terminators()
Property: string termination code points.
Definition: BinaryString.h:743
void lengthEncodingScheme(const LengthEncodingScheme::Ptr &les)
Property: Lengh encoding scheme.
Definition: BinaryString.h:674
Sawyer::SharedPointer< Utf8CharacterEncodingForm > Ptr
Shared-ownership pointer to a Utf8CharacterEncodingForm.
Definition: BinaryString.h:292
Utf8CharacterEncodingForm::Ptr utf8CharacterEncodingForm()
Returns a new UTF-8 character encoding form.
Decoder is in an error condition.
Definition: BinaryString.h:202
Length-prefixed string encoding scheme.
Definition: BinaryString.h:629
std::vector< StringEncodingScheme::Ptr > & encoders()
Property: List of string encodings.
Definition: BinaryString.h:888
virtual std::string name() const ROSE_OVERRIDE
Name of predicate.
Definition: BinaryString.h:507
virtual std::string name() const ROSE_OVERRIDE
Name of predicate.
Definition: BinaryString.h:522
Base class for all ROSE exceptions.
Definition: RoseException.h:9
virtual Ptr clone() const ROSE_OVERRIDE
Create a new copy of this encoder.
Definition: BinaryString.h:391
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:766