Format changed lines with clang-format-3.6 --style=file.

This commit is contained in:
Keith Wansbrough 2015-11-07 12:01:27 +00:00
parent 9b47827887
commit 1117b9d17d
6 changed files with 38 additions and 67 deletions

View file

@ -3,21 +3,14 @@
#include "framework.hpp"
ApiUserMarkContainer::ApiUserMarkContainer(double layerDepth, Framework & framework)
: UserMarkContainer(layerDepth, framework)
{
}
string ApiUserMarkContainer::GetTypeName() const
{
return "api-result";
}
string ApiUserMarkContainer::GetTypeName() const { return "api-result"; }
string ApiUserMarkContainer::GetActiveTypeName() const
{
return "search-result-active";
}
string ApiUserMarkContainer::GetActiveTypeName() const { return "search-result-active"; }
UserMark * ApiUserMarkContainer::AllocateUserMark(const m2::PointD & ptOrg)
{

View file

@ -11,8 +11,8 @@ public:
virtual Type GetType() const { return API_MARK; }
virtual string GetActiveTypeName() const;
protected:
virtual string GetTypeName() const;
virtual UserMark * AllocateUserMark(m2::PointD const & ptOrg);
};

View file

@ -11,14 +11,9 @@ public:
{
}
ApiMarkPoint(string const & name,
string const & id,
string const & style,
m2::PointD const & ptOrg,
UserMarkContainer * container)
: StyledPoint(style, ptOrg, container)
, m_name(name)
, m_id(id)
ApiMarkPoint(string const & name, string const & id, string const & style,
m2::PointD const & ptOrg, UserMarkContainer * container)
: StyledPoint(style, ptOrg, container), m_name(name), m_id(id)
{
}
@ -27,8 +22,8 @@ public:
string const & GetName() const { return m_name; }
void SetName(string const & name) { m_name = name; }
string const & GetID() const { return m_id; }
void SetID(string const & id) { m_id = id; }
string const & GetID() const { return m_id; }
void SetID(string const & id) { m_id = id; }
unique_ptr<UserMarkCopy> Copy() const override
{
@ -47,4 +42,3 @@ private:
string m_name;
string m_id;
};

View file

@ -73,17 +73,12 @@ class Bookmark : public StyledPoint
public:
Bookmark(m2::PointD const & ptOrg, UserMarkContainer * container)
: StyledPoint(ptOrg, container)
, m_animScaleFactor(1.0)
: StyledPoint(ptOrg, container), m_animScaleFactor(1.0)
{
}
Bookmark(BookmarkData const & data,
m2::PointD const & ptOrg,
UserMarkContainer * container)
: StyledPoint(data.GetType(), ptOrg, container)
, m_data(data)
, m_animScaleFactor(1.0)
Bookmark(BookmarkData const & data, m2::PointD const & ptOrg, UserMarkContainer * container)
: StyledPoint(data.GetType(), ptOrg, container), m_data(data), m_animScaleFactor(1.0)
{
}

View file

@ -1,13 +1,12 @@
#include "map/styled_point.hpp"
graphics::DisplayList * StyledPoint::GetDisplayList(UserMarkDLCache * cache) const
{
UserMarkContainer const * container = GetContainer();
UserMarkDLCache::Key const key = GetStyle().empty() ? container->GetDefaultKey()
: UserMarkDLCache::Key(GetStyle(),
graphics::EPosAbove,
container->GetDepth());
UserMarkDLCache::Key const key =
GetStyle().empty()
? container->GetDefaultKey()
: UserMarkDLCache::Key(GetStyle(), graphics::EPosAbove, container->GetDepth());
return cache->FindUserMark(key);
}
@ -27,31 +26,26 @@ m2::PointD const & StyledPoint::GetPixelOffset() const
return GetStyle().empty() ? s_centre : s_offset;
}
static char const * s_arrSupportedColors[] =
{
"placemark-red", "placemark-blue", "placemark-purple", "placemark-yellow",
"placemark-pink", "placemark-brown", "placemark-green", "placemark-orange"
};
static char const * s_arrSupportedColors[] = {
"placemark-red", "placemark-blue", "placemark-purple", "placemark-yellow",
"placemark-pink", "placemark-brown", "placemark-green", "placemark-orange"};
namespace style
{
string GetSupportedStyle(string const & s, string const & context, string const & fallback)
{
if (s.empty())
return fallback;
for (size_t i = 0; i < ARRAY_SIZE(s_arrSupportedColors); ++i)
if (s == s_arrSupportedColors[i])
return s;
// Not recognized symbols are replaced with default one
LOG(LWARNING, ("Icon", s, "for point", context, "is not supported"));
string GetSupportedStyle(string const & s, string const & context, string const & fallback)
{
if (s.empty())
return fallback;
}
string GetDefaultStyle()
{
return s_arrSupportedColors[0];
}
for (size_t i = 0; i < ARRAY_SIZE(s_arrSupportedColors); ++i)
if (s == s_arrSupportedColors[i])
return s;
} // namespace style
// Not recognized symbols are replaced with default one
LOG(LWARNING, ("Icon", s, "for point", context, "is not supported"));
return fallback;
}
string GetDefaultStyle() { return s_arrSupportedColors[0]; }
} // namespace style

View file

@ -13,28 +13,24 @@
#include "std/unique_ptr.hpp"
#include "std/utility.hpp"
namespace style
{
// Fixes icons which are not supported by MapsWithMe.
string GetSupportedStyle(string const & s, string const & context, string const & fallback);
// Default icon.
string GetDefaultStyle();
// Fixes icons which are not supported by MapsWithMe.
string GetSupportedStyle(string const & s, string const & context, string const & fallback);
// Default icon.
string GetDefaultStyle();
} // namespace style
class StyledPoint : public ICustomDrawable
{
public:
StyledPoint(m2::PointD const & ptOrg, UserMarkContainer * container)
: ICustomDrawable(ptOrg, container)
, m_style(style::GetDefaultStyle())
: ICustomDrawable(ptOrg, container), m_style(style::GetDefaultStyle())
{
}
StyledPoint(string const & style, m2::PointD const & ptOrg, UserMarkContainer * container)
: ICustomDrawable(ptOrg, container)
, m_style(style)
: ICustomDrawable(ptOrg, container), m_style(style)
{
}
@ -48,4 +44,3 @@ public:
private:
string m_style; ///< Point style (name of icon), or empty string for plain circle.
};