This source file includes following definitions.
- create
- create
- addPair
- getOpenQuote
- getCloseQuote
- equals
#include "config.h"
#include "core/rendering/style/QuotesData.h"
namespace WebCore {
PassRefPtr<QuotesData> QuotesData::create(String open, String close)
{
RefPtr<QuotesData> data = QuotesData::create();
data->addPair(std::make_pair(open, close));
return data;
}
PassRefPtr<QuotesData> QuotesData::create(UChar open1, UChar close1, UChar open2, UChar close2)
{
RefPtr<QuotesData> data = QuotesData::create();
data->addPair(std::make_pair(String(&open1, 1), String(&close1, 1)));
data->addPair(std::make_pair(String(&open2, 1), String(&close2, 1)));
return data;
}
void QuotesData::addPair(std::pair<String, String> quotePair)
{
m_quotePairs.append(quotePair);
}
const String QuotesData::getOpenQuote(int index) const
{
ASSERT(index >= 0);
if (!m_quotePairs.size() || index < 0)
return emptyString();
if ((size_t)index >= m_quotePairs.size())
return m_quotePairs.last().first;
return m_quotePairs.at(index).first;
}
const String QuotesData::getCloseQuote(int index) const
{
ASSERT(index >= -1);
if (!m_quotePairs.size() || index < 0)
return emptyString();
if ((size_t)index >= m_quotePairs.size())
return m_quotePairs.last().second;
return m_quotePairs.at(index).second;
}
bool QuotesData::equals(const QuotesData* a, const QuotesData* b)
{
if (a == b)
return true;
if (!a || !b)
return false;
return a->m_quotePairs == b->m_quotePairs;
}
}