[dasher: 7/38] const sprinkle CDasherNode::mgr(), CAlphNode::outputText()
- From: Patrick Welche <pwelche src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dasher: 7/38] const sprinkle CDasherNode::mgr(), CAlphNode::outputText()
- Date: Tue, 3 Jan 2012 15:33:15 +0000 (UTC)
commit 53fd5b3609931d629d827429dc1e8e46903e47ce
Author: Alan Lawrence <acl33 inf phy cam ac uk>
Date: Tue Dec 6 17:01:56 2011 +0000
const sprinkle CDasherNode::mgr(), CAlphNode::outputText()
Src/DasherCore/AlphabetManager.cpp | 4 ++--
Src/DasherCore/AlphabetManager.h | 4 ++--
Src/DasherCore/ControlManager.h | 2 +-
Src/DasherCore/ConversionManager.h | 2 +-
Src/DasherCore/DasherNode.h | 2 +-
Src/DasherCore/MandarinAlphMgr.cpp | 2 +-
Src/DasherCore/MandarinAlphMgr.h | 4 ++--
7 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/Src/DasherCore/AlphabetManager.cpp b/Src/DasherCore/AlphabetManager.cpp
index e298134..8c11712 100644
--- a/Src/DasherCore/AlphabetManager.cpp
+++ b/Src/DasherCore/AlphabetManager.cpp
@@ -546,7 +546,7 @@ CAlphabetManager::CAlphNode::~CAlphNode() {
m_pMgr->m_pLanguageModel->ReleaseContext(iContext);
}
-const std::string &CAlphabetManager::CSymbolNode::outputText() {
+const std::string &CAlphabetManager::CSymbolNode::outputText() const {
if (iSymbol == m_pMgr->m_pAlphabet->GetParagraphSymbol() && GetFlag(NF_SEEN)) {
//Regardless of this particular platform's definition of a newline,
// which is what we'd _output_, when reversing back over text
@@ -594,7 +594,7 @@ void CAlphabetManager::CSymbolNode::Output() {
SymbolProb CAlphabetManager::CSymbolNode::GetSymbolProb() const {
//TODO probability here not right - Range() is relative to parent, not prev symbol
- return Dasher::SymbolProb(iSymbol, m_pMgr->m_pAlphabet->GetText(iSymbol), Range() / (double)CDasherModel::NORMALIZATION);
+ return Dasher::SymbolProb(iSymbol, outputText(), Range() / (double)CDasherModel::NORMALIZATION);
}
void CAlphabetManager::CSymbolNode::Undo() {
diff --git a/Src/DasherCore/AlphabetManager.h b/Src/DasherCore/AlphabetManager.h
index c37d423..5fec4fa 100644
--- a/Src/DasherCore/AlphabetManager.h
+++ b/Src/DasherCore/AlphabetManager.h
@@ -90,7 +90,7 @@ namespace Dasher {
/// code for rebuilding parent nodes = reversing.
class CAlphBase : public CDasherNode {
public:
- CAlphabetManager *mgr() {return m_pMgr;}
+ CAlphabetManager *mgr() const {return m_pMgr;}
///Rebuilds this node's parent by recreating the previous 'root' node,
/// then calling RebuildForwardsFromAncestor
CDasherNode *RebuildParent();
@@ -164,7 +164,7 @@ namespace Dasher {
///Override: if the symbol to create is the same as this node's symbol, return this node instead of creating a new one
virtual CDasherNode *RebuildSymbol(CAlphNode *pParent, symbol iSymbol);
protected:
- virtual const std::string &outputText();
+ virtual const std::string &outputText() const;
///Text to write to user training file/buffer when this symbol output.
/// Default just returns (a new string constructed from) outputText()
virtual std::string trainText() {return outputText();}
diff --git a/Src/DasherCore/ControlManager.h b/Src/DasherCore/ControlManager.h
index edab73a..3b866aa 100644
--- a/Src/DasherCore/ControlManager.h
+++ b/Src/DasherCore/ControlManager.h
@@ -59,7 +59,7 @@ namespace Dasher {
class CContNode : public CDasherNode {
public:
- CControlBase *mgr() {return m_pMgr;}
+ CControlBase *mgr() const {return m_pMgr;}
CContNode(int iOffset, int iColour, NodeTemplate *pTemplate, CControlBase *pMgr);
bool bShove() {return false;}
diff --git a/Src/DasherCore/ConversionManager.h b/Src/DasherCore/ConversionManager.h
index ccd3e4f..0050fcd 100644
--- a/Src/DasherCore/ConversionManager.h
+++ b/Src/DasherCore/ConversionManager.h
@@ -80,7 +80,7 @@ namespace Dasher {
class CConvNode : public CDasherNode {
public:
- CConversionManager *mgr() {return m_pMgr;}
+ CConversionManager *mgr() const {return m_pMgr;}
CConvNode(int iOffset, int iColour, CDasherScreen::Label *pLabel, CConversionManager *pMgr);
///
/// Provide children for the supplied node
diff --git a/Src/DasherCore/DasherNode.h b/Src/DasherCore/DasherNode.h
index 8518acd..2dc890f 100644
--- a/Src/DasherCore/DasherNode.h
+++ b/Src/DasherCore/DasherNode.h
@@ -227,7 +227,7 @@ class Dasher::CDasherNode:private NoClones {
/// Gets the node manager for this object. Meaning defined by subclasses,
/// which should override and refine the return type appropriately;
/// the main use is to provide runtime type info to check casting!
- virtual CNodeManager *mgr() = 0;
+ virtual CNodeManager *mgr() const = 0;
///
/// Provide children for the supplied node
///
diff --git a/Src/DasherCore/MandarinAlphMgr.cpp b/Src/DasherCore/MandarinAlphMgr.cpp
index b7db103..0ee1246 100644
--- a/Src/DasherCore/MandarinAlphMgr.cpp
+++ b/Src/DasherCore/MandarinAlphMgr.cpp
@@ -422,7 +422,7 @@ void CMandarinAlphMgr::CMandSym::RebuildForwardsFromAncestor(CAlphNode *pNewNode
CSymbolNode::RebuildForwardsFromAncestor(pNewNode);
}
-const std::string &CMandarinAlphMgr::CMandSym::outputText() {
+const std::string &CMandarinAlphMgr::CMandSym::outputText() const {
return mgr()->m_CHtext[iSymbol];
}
diff --git a/Src/DasherCore/MandarinAlphMgr.h b/Src/DasherCore/MandarinAlphMgr.h
index 929b16c..bce3ae2 100644
--- a/Src/DasherCore/MandarinAlphMgr.h
+++ b/Src/DasherCore/MandarinAlphMgr.h
@@ -99,7 +99,7 @@ namespace Dasher {
///Override to output a triple (delimiter,PY,CH)
virtual std::string trainText();
///Override to use use chinese, not pinyin, alphabet
- virtual const std::string &outputText();
+ virtual const std::string &outputText() const;
///The Pinyin symbol used to produce this chinese symbol, if known (0 if not!)
symbol m_pyParent;
};
@@ -110,7 +110,7 @@ namespace Dasher {
public:
/// \param pySym symbol in pinyin alphabet; must have >1 possible chinese conversion.
CConvRoot(int iOffset, CMandarinAlphMgr *pMgr, symbol pySym);
- CMandarinAlphMgr *mgr() {return static_cast<CMandarinAlphMgr *>(CAlphBase::mgr());}
+ CMandarinAlphMgr *mgr() const {return static_cast<CMandarinAlphMgr *>(CAlphBase::mgr());}
void PopulateChildren();
void PopulateChildrenWithExisting(CMandSym *existing);
int ExpectedNumChildren();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]