12.06.2015 Views

The Annoyance Filter.pdf - Fourmilab

The Annoyance Filter.pdf - Fourmilab

The Annoyance Filter.pdf - Fourmilab

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

§87 ANNOYANCE-FILTER INTERPRETERS 75<br />

87. Interpreters.<br />

88. Interpreter parent class.<br />

This is the abstract parent class of all concrete interpreters. We provide the services common to most<br />

decoders, while permitting them to be overridden by derived classes.<br />

〈 Class definitions 10 〉 +≡<br />

class MBCSinterpreter {<br />

protected:<br />

const string ∗src;<br />

MBCSdecoder ∗dp;<br />

string prefix , suffix ;<br />

public:<br />

virtual ∼MBCSinterpreter( )<br />

{ }<br />

virtual string name (void) = 0; /∗ Name of decoder ∗/<br />

virtual void setDecoder (MBCSdecoder &d)<br />

{<br />

dp = &d;<br />

}<br />

virtual void setSource (const string &s)<br />

{ /∗ Set input source line ∗/<br />

assert(dp ≠ Λ);<br />

dp ⃗ setSource (s);<br />

}<br />

virtual void setPrefixSuffix (string pre = "", string suf = "")<br />

{<br />

prefix = pre ;<br />

suffix = suf ;<br />

}<br />

virtual string getNextDecodedChar (void);<br />

virtual string decodeLine (const string &s);<br />

};

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!