Added component::getChildComponents() function.
This commit is contained in:
parent
854a50bc8c
commit
3217dd9bf9
@ -248,6 +248,14 @@ const std::vector <address*> addressList::getAddressList()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const std::vector <const component*> addressList::getChildComponents() const
|
||||||
|
{
|
||||||
|
std::vector <const component*> list;
|
||||||
|
|
||||||
|
copy_vector(m_list, list);
|
||||||
|
|
||||||
|
return (list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // vmime
|
} // vmime
|
||||||
|
@ -52,6 +52,8 @@ public:
|
|||||||
addressList& operator=(const addressList& other);
|
addressList& operator=(const addressList& other);
|
||||||
addressList& operator=(const mailboxList& other);
|
addressList& operator=(const mailboxList& other);
|
||||||
|
|
||||||
|
const std::vector <const component*> getChildComponents() const;
|
||||||
|
|
||||||
|
|
||||||
/** Add a address at the end of the list.
|
/** Add a address at the end of the list.
|
||||||
*
|
*
|
||||||
|
13
src/base.hpp
13
src/base.hpp
@ -90,6 +90,19 @@ namespace vmime
|
|||||||
c.clear();
|
c.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Copy one vector to another, with type conversion
|
||||||
|
|
||||||
|
template <class T1, class T2>
|
||||||
|
void copy_vector(T1& v1, T2& v2)
|
||||||
|
{
|
||||||
|
const typename T1::size_type count = v1.size();
|
||||||
|
|
||||||
|
v2.resize(count);
|
||||||
|
|
||||||
|
for (typename T1::size_type i = 0 ; i < count ; ++i)
|
||||||
|
v2[i] = v1[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
|
10
src/body.cpp
10
src/body.cpp
@ -706,4 +706,14 @@ const std::vector <bodyPart*> body::getPartList()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const std::vector <const component*> body::getChildComponents() const
|
||||||
|
{
|
||||||
|
std::vector <const component*> list;
|
||||||
|
|
||||||
|
copy_vector(m_parts, list);
|
||||||
|
|
||||||
|
return (list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // vmime
|
} // vmime
|
||||||
|
@ -231,6 +231,8 @@ public:
|
|||||||
void copyFrom(const component& other);
|
void copyFrom(const component& other);
|
||||||
body& operator=(const body& other);
|
body& operator=(const body& other);
|
||||||
|
|
||||||
|
const std::vector <const component*> getChildComponents() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
string m_prologText;
|
string m_prologText;
|
||||||
|
@ -120,5 +120,16 @@ bodyPart* bodyPart::getParentPart() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const std::vector <const component*> bodyPart::getChildComponents() const
|
||||||
|
{
|
||||||
|
std::vector <const component*> list;
|
||||||
|
|
||||||
|
list.push_back(&m_header);
|
||||||
|
list.push_back(&m_body);
|
||||||
|
|
||||||
|
return (list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // vmime
|
} // vmime
|
||||||
|
|
||||||
|
@ -77,6 +77,8 @@ public:
|
|||||||
void copyFrom(const component& other);
|
void copyFrom(const component& other);
|
||||||
bodyPart& operator=(const bodyPart& other);
|
bodyPart& operator=(const bodyPart& other);
|
||||||
|
|
||||||
|
const std::vector <const component*> getChildComponents() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
header m_header;
|
header m_header;
|
||||||
|
@ -274,4 +274,10 @@ void charset::copyFrom(const component& other)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const std::vector <const component*> charset::getChildComponents() const
|
||||||
|
{
|
||||||
|
return std::vector <const component*>();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // vmime
|
} // vmime
|
||||||
|
@ -53,6 +53,8 @@ public:
|
|||||||
const bool operator==(const charset& value) const;
|
const bool operator==(const charset& value) const;
|
||||||
const bool operator!=(const charset& value) const;
|
const bool operator!=(const charset& value) const;
|
||||||
|
|
||||||
|
const std::vector <const component*> getChildComponents() const;
|
||||||
|
|
||||||
/** Returns the default charset used on the system.
|
/** Returns the default charset used on the system.
|
||||||
*
|
*
|
||||||
* This function simply calls <code>platformDependantHandler::getLocaleCharset()</code>
|
* This function simply calls <code>platformDependantHandler::getLocaleCharset()</code>
|
||||||
|
@ -75,4 +75,22 @@ void component::setParsedBounds(const string::size_type start, const string::siz
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const std::vector <component*> component::getChildComponents()
|
||||||
|
{
|
||||||
|
const std::vector <const component*> constList =
|
||||||
|
const_cast <const component*>(this)->getChildComponents();
|
||||||
|
|
||||||
|
std::vector <component*> list;
|
||||||
|
|
||||||
|
const std::vector <const component*>::size_type count = constList.size();
|
||||||
|
|
||||||
|
list.resize(count);
|
||||||
|
|
||||||
|
for (std::vector <const component*>::size_type i = 0 ; i < count ; ++i)
|
||||||
|
list[i] = const_cast <component*>(constList[i]);
|
||||||
|
|
||||||
|
return (list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -104,6 +104,18 @@ public:
|
|||||||
*/
|
*/
|
||||||
const string::size_type getParsedLength() const;
|
const string::size_type getParsedLength() const;
|
||||||
|
|
||||||
|
/** Return the list of children of this component.
|
||||||
|
*
|
||||||
|
* @return list of child components
|
||||||
|
*/
|
||||||
|
const std::vector <component*> getChildComponents();
|
||||||
|
|
||||||
|
/** Return the list of children of this component (const version).
|
||||||
|
*
|
||||||
|
* @return list of child components
|
||||||
|
*/
|
||||||
|
virtual const std::vector <const component*> getChildComponents() const = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
void setParsedBounds(const string::size_type start, const string::size_type end);
|
void setParsedBounds(const string::size_type start, const string::size_type end);
|
||||||
|
@ -709,6 +709,12 @@ datetime* datetime::clone() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const std::vector <const component*> datetime::getChildComponents() const
|
||||||
|
{
|
||||||
|
return std::vector <const component*>();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const int datetime::getYear() const { return (m_year); }
|
const int datetime::getYear() const { return (m_year); }
|
||||||
const int datetime::getMonth() const { return (m_month); }
|
const int datetime::getMonth() const { return (m_month); }
|
||||||
const int datetime::getDay() const { return (m_day); }
|
const int datetime::getDay() const { return (m_day); }
|
||||||
|
@ -220,6 +220,8 @@ public:
|
|||||||
// Current date and time
|
// Current date and time
|
||||||
static const datetime now();
|
static const datetime now();
|
||||||
|
|
||||||
|
const std::vector <const component*> getChildComponents() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
static const int dayOfWeek(const int year, const int month, const int day);
|
static const int dayOfWeek(const int year, const int month, const int day);
|
||||||
|
@ -117,4 +117,10 @@ void disposition::setName(const string& name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const std::vector <const component*> disposition::getChildComponents() const
|
||||||
|
{
|
||||||
|
return std::vector <const component*>();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // vmime
|
} // vmime
|
||||||
|
@ -59,6 +59,8 @@ public:
|
|||||||
void copyFrom(const component& other);
|
void copyFrom(const component& other);
|
||||||
disposition& operator=(const disposition& other);
|
disposition& operator=(const disposition& other);
|
||||||
|
|
||||||
|
const std::vector <const component*> getChildComponents() const;
|
||||||
|
|
||||||
|
|
||||||
disposition& operator=(const string& name);
|
disposition& operator=(const string& name);
|
||||||
|
|
||||||
|
@ -187,4 +187,10 @@ void encoding::setName(const string& name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const std::vector <const component*> encoding::getChildComponents() const
|
||||||
|
{
|
||||||
|
return std::vector <const component*>();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // vmime
|
} // vmime
|
||||||
|
@ -66,6 +66,8 @@ public:
|
|||||||
const bool operator==(const encoding& value) const;
|
const bool operator==(const encoding& value) const;
|
||||||
const bool operator!=(const encoding& value) const;
|
const bool operator!=(const encoding& value) const;
|
||||||
|
|
||||||
|
const std::vector <const component*> getChildComponents() const;
|
||||||
|
|
||||||
/** Decide which encoding to use based on the specified data.
|
/** Decide which encoding to use based on the specified data.
|
||||||
*
|
*
|
||||||
* \deprecated Use the new decide() method which takes a contentHandler parameter.
|
* \deprecated Use the new decide() method which takes a contentHandler parameter.
|
||||||
|
@ -510,4 +510,14 @@ const std::vector <headerField*> header::getFieldList()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const std::vector <const component*> header::getChildComponents() const
|
||||||
|
{
|
||||||
|
std::vector <const component*> list;
|
||||||
|
|
||||||
|
copy_vector(m_fields, list);
|
||||||
|
|
||||||
|
return (list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // vmime
|
} // vmime
|
||||||
|
@ -214,6 +214,8 @@ public:
|
|||||||
void copyFrom(const component& other);
|
void copyFrom(const component& other);
|
||||||
header& operator=(const header& other);
|
header& operator=(const header& other);
|
||||||
|
|
||||||
|
const std::vector <const component*> getChildComponents() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
std::vector <headerField*> m_fields;
|
std::vector <headerField*> m_fields;
|
||||||
|
@ -97,4 +97,14 @@ const bool headerField::isCustom() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const std::vector <const component*> headerField::getChildComponents() const
|
||||||
|
{
|
||||||
|
std::vector <const component*> list;
|
||||||
|
|
||||||
|
list.push_back(&getValue());
|
||||||
|
|
||||||
|
return (list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // vmime
|
} // vmime
|
||||||
|
@ -49,6 +49,8 @@ public:
|
|||||||
void copyFrom(const component& other);
|
void copyFrom(const component& other);
|
||||||
headerField& operator=(const headerField& other);
|
headerField& operator=(const headerField& other);
|
||||||
|
|
||||||
|
const std::vector <const component*> getChildComponents() const;
|
||||||
|
|
||||||
/** Return the name of this field.
|
/** Return the name of this field.
|
||||||
*
|
*
|
||||||
* @return field name
|
* @return field name
|
||||||
|
@ -504,4 +504,10 @@ void mailbox::setEmail(const string& email)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const std::vector <const component*> mailbox::getChildComponents() const
|
||||||
|
{
|
||||||
|
return std::vector <const component*>();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // vmime
|
} // vmime
|
||||||
|
@ -81,6 +81,8 @@ public:
|
|||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
|
const std::vector <const component*> getChildComponents() const;
|
||||||
|
|
||||||
|
|
||||||
const bool isGroup() const;
|
const bool isGroup() const;
|
||||||
|
|
||||||
|
@ -350,4 +350,15 @@ const std::vector <mailbox*> mailboxGroup::getMailboxList()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const std::vector <const component*> mailboxGroup::getChildComponents() const
|
||||||
|
{
|
||||||
|
std::vector <const component*> list;
|
||||||
|
|
||||||
|
copy_vector(m_list, list);
|
||||||
|
|
||||||
|
return (list);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // vmime
|
} // vmime
|
||||||
|
@ -48,6 +48,8 @@ public:
|
|||||||
mailboxGroup* clone() const;
|
mailboxGroup* clone() const;
|
||||||
mailboxGroup& operator=(const component& other);
|
mailboxGroup& operator=(const component& other);
|
||||||
|
|
||||||
|
const std::vector <const component*> getChildComponents() const;
|
||||||
|
|
||||||
/** Return the name of the group.
|
/** Return the name of the group.
|
||||||
*
|
*
|
||||||
* @return group name
|
* @return group name
|
||||||
|
@ -169,4 +169,10 @@ void mediaType::setFromString(const string& type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const std::vector <const component*> mediaType::getChildComponents() const
|
||||||
|
{
|
||||||
|
return std::vector <const component*>();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // vmime
|
} // vmime
|
||||||
|
@ -51,6 +51,8 @@ public:
|
|||||||
void copyFrom(const component& other);
|
void copyFrom(const component& other);
|
||||||
mediaType& operator=(const mediaType& other);
|
mediaType& operator=(const mediaType& other);
|
||||||
|
|
||||||
|
const std::vector <const component*> getChildComponents() const;
|
||||||
|
|
||||||
/** Return the media type.
|
/** Return the media type.
|
||||||
* See the constants in vmime::mediaTypes.
|
* See the constants in vmime::mediaTypes.
|
||||||
*
|
*
|
||||||
|
@ -227,4 +227,10 @@ void messageId::setRight(const string& right)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const std::vector <const component*> messageId::getChildComponents() const
|
||||||
|
{
|
||||||
|
return std::vector <const component*>();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // vmime
|
} // vmime
|
||||||
|
@ -91,6 +91,8 @@ public:
|
|||||||
void copyFrom(const component& other);
|
void copyFrom(const component& other);
|
||||||
messageId& operator=(const messageId& other);
|
messageId& operator=(const messageId& other);
|
||||||
|
|
||||||
|
const std::vector <const component*> getChildComponents() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
string m_left;
|
string m_left;
|
||||||
|
@ -149,4 +149,14 @@ void parameter::generateValue(utility::outputStream& os, const string::size_type
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const std::vector <const component*> parameter::getChildComponents() const
|
||||||
|
{
|
||||||
|
std::vector <const component*> list;
|
||||||
|
|
||||||
|
list.push_back(&getValue());
|
||||||
|
|
||||||
|
return (list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // vmime
|
} // vmime
|
||||||
|
@ -39,6 +39,8 @@ public:
|
|||||||
void copyFrom(const component& other);
|
void copyFrom(const component& other);
|
||||||
parameter& operator=(const parameter& other);
|
parameter& operator=(const parameter& other);
|
||||||
|
|
||||||
|
const std::vector <const component*> getChildComponents() const;
|
||||||
|
|
||||||
/** Return the name of the parameter.
|
/** Return the name of the parameter.
|
||||||
*
|
*
|
||||||
* @return name of the parameter
|
* @return name of the parameter
|
||||||
|
@ -334,4 +334,11 @@ std::vector <string>& relay::getWithList()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const std::vector <const component*> relay::getChildComponents() const
|
||||||
|
{
|
||||||
|
// TODO: should fields inherit from 'component'? (using typeAdapter)
|
||||||
|
return std::vector <const component*>();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // vmime
|
} // vmime
|
||||||
|
@ -47,6 +47,8 @@ public:
|
|||||||
void copyFrom(const component& other);
|
void copyFrom(const component& other);
|
||||||
relay& operator=(const relay& other);
|
relay& operator=(const relay& other);
|
||||||
|
|
||||||
|
const std::vector <const component*> getChildComponents() const;
|
||||||
|
|
||||||
const string& getFrom() const;
|
const string& getFrom() const;
|
||||||
void setFrom(const string& from);
|
void setFrom(const string& from);
|
||||||
|
|
||||||
|
@ -840,4 +840,11 @@ void text::decodeAndUnfold(const string::const_iterator& inStart, const string::
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const std::vector <const component*> text::getChildComponents() const
|
||||||
|
{
|
||||||
|
// TODO: 'word' should inherit from 'component'
|
||||||
|
return std::vector <const component*>();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // vmime
|
} // vmime
|
||||||
|
@ -53,6 +53,8 @@ public:
|
|||||||
text& operator=(const component& other);
|
text& operator=(const component& other);
|
||||||
text& operator=(const text& other);
|
text& operator=(const text& other);
|
||||||
|
|
||||||
|
const std::vector <const component*> getChildComponents() const;
|
||||||
|
|
||||||
/** Add a word at the end of the list.
|
/** Add a word at the end of the list.
|
||||||
*
|
*
|
||||||
* @param w word to append
|
* @param w word to append
|
||||||
|
@ -107,6 +107,11 @@ public:
|
|||||||
*newLinePos = curLinePos + oss.str().length();
|
*newLinePos = curLinePos + oss.str().length();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::vector <const component*> getChildComponents() const
|
||||||
|
{
|
||||||
|
return std::vector <const component*>();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
TYPE m_value;
|
TYPE m_value;
|
||||||
|
Loading…
Reference in New Issue
Block a user