summaryrefslogtreecommitdiff
path: root/indra/llxml/llxmlnode.cpp
diff options
context:
space:
mode:
authorSteven Bennetts <steve@lindenlab.com>2008-02-19 21:42:32 +0000
committerSteven Bennetts <steve@lindenlab.com>2008-02-19 21:42:32 +0000
commit2e32d44e7165775936beae5d9ef636ff9d3f2bd2 (patch)
tree8153bc399994aabf6e1c41c2d8332e4e8c4ddb78 /indra/llxml/llxmlnode.cpp
parentdb0f5847ea8b96b3c1ac08e7aeb43d83daacb8e4 (diff)
merge svn+ssh://svn.lindenlab.com/svn/linden/qa/combo-merge-ui-2008-02-13 -r 79986 : 80178 -> release.
QAR-290 = QAR-271 + QAR-191
Diffstat (limited to 'indra/llxml/llxmlnode.cpp')
-rw-r--r--indra/llxml/llxmlnode.cpp107
1 files changed, 46 insertions, 61 deletions
diff --git a/indra/llxml/llxmlnode.cpp b/indra/llxml/llxmlnode.cpp
index 4501daf7a0..9b0675945d 100644
--- a/indra/llxml/llxmlnode.cpp
+++ b/indra/llxml/llxmlnode.cpp
@@ -3024,80 +3024,65 @@ LLXMLNodePtr LLXMLNode::getNextSibling()
LLString LLXMLNode::getTextContents() const
{
std::string msg;
- LLXMLNodeList p_children;
- getChildren("p", p_children);
- if (p_children.size() > 0)
- {
- // Case 1: node has <p>text</p> tags
- LLXMLNodeList::iterator itor;
- for (itor = p_children.begin(); itor != p_children.end(); ++itor)
- {
- LLXMLNodePtr p = itor->second;
- msg += p->getValue() + "\n";
- }
- }
- else
- {
- LLString contents = mValue;
- std::string::size_type n = contents.find_first_not_of(" \t\n");
- if (n != std::string::npos && contents[n] == '\"')
- {
- // Case 2: node has quoted text
- S32 num_lines = 0;
+ LLString contents = mValue;
+ std::string::size_type n = contents.find_first_not_of(" \t\n");
+ if (n != std::string::npos && contents[n] == '\"')
+ {
+ // Case 1: node has quoted text
+ S32 num_lines = 0;
+ while(1)
+ {
+ // mContents[n] == '"'
+ ++n;
+ std::string::size_type t = n;
+ std::string::size_type m = 0;
+ // fix-up escaped characters
while(1)
{
- // mContents[n] == '"'
- ++n;
- std::string::size_type t = n;
- std::string::size_type m = 0;
- // fix-up escaped characters
- while(1)
- {
- m = contents.find_first_of("\\\"", t); // find first \ or "
- if ((m == std::string::npos) || (contents[m] == '\"'))
- {
- break;
- }
- contents.erase(m,1);
- t = m+1;
- }
- if (m == std::string::npos)
+ m = contents.find_first_of("\\\"", t); // find first \ or "
+ if ((m == std::string::npos) || (contents[m] == '\"'))
{
break;
}
- // mContents[m] == '"'
- num_lines++;
- msg += contents.substr(n,m-n) + "\n";
- n = contents.find_first_of("\"", m+1);
- if (n == std::string::npos)
+ contents.erase(m,1);
+ t = m+1;
+ }
+ if (m == std::string::npos)
+ {
+ break;
+ }
+ // mContents[m] == '"'
+ num_lines++;
+ msg += contents.substr(n,m-n) + "\n";
+ n = contents.find_first_of("\"", m+1);
+ if (n == std::string::npos)
+ {
+ if (num_lines == 1)
{
- if (num_lines == 1)
- {
- msg.erase(msg.size()-1); // remove "\n" if only one line
- }
- break;
+ msg.erase(msg.size()-1); // remove "\n" if only one line
}
+ break;
}
}
- else
+ }
+ else
+ {
+ // Case 2: node has embedded text (beginning and trailing whitespace trimmed)
+ LLString::size_type start = mValue.find_first_not_of(" \t\n");
+ if (start != mValue.npos)
{
- // Case 3: node has embedded text (beginning and trailing whitespace trimmed)
- LLString::size_type start = mValue.find_first_not_of(" \t\n");
- if (start != mValue.npos)
+ LLString::size_type end = mValue.find_last_not_of(" \t\n");
+ if (end != mValue.npos)
{
- LLString::size_type end = mValue.find_last_not_of(" \t\n");
- if (end != mValue.npos)
- {
- msg = mValue.substr(start, end+1-start);
- }
- else
- {
- msg = mValue.substr(start);
- }
+ msg = mValue.substr(start, end+1-start);
+ }
+ else
+ {
+ msg = mValue.substr(start);
}
- // Convert any internal CR to LF
- msg = utf8str_removeCRLF(msg);
}
+ // Convert any internal CR to LF
+ msg = utf8str_removeCRLF(msg);
}
return msg;
}