Style changes, replace typedefs with usings

This commit is contained in:
Maxime Coste 2014-01-09 19:50:01 +00:00
parent 560b4ab0b5
commit e6884f989c
12 changed files with 30 additions and 32 deletions

View File

@ -6,7 +6,6 @@
#include "option_manager.hh" #include "option_manager.hh"
#include "keymap_manager.hh" #include "keymap_manager.hh"
#include "string.hh" #include "string.hh"
#include "units.hh"
#include <vector> #include <vector>
#include <list> #include <list>
@ -30,11 +29,11 @@ struct BufferCoord : LineAndColumn<BufferCoord, LineCount, ByteCount>
class BufferIterator class BufferIterator
{ {
public: public:
typedef char value_type; using value_type = char;
typedef size_t difference_type; using difference_type = size_t;
typedef const value_type* pointer; using pointer = const value_type*;
typedef const value_type& reference; using reference = const value_type&;
typedef std::random_access_iterator_tag iterator_category; using iterator_category = std::random_access_iterator_tag;
BufferIterator() : m_buffer(nullptr) {} BufferIterator() : m_buffer(nullptr) {}
BufferIterator(const Buffer& buffer, BufferCoord coord); BufferIterator(const Buffer& buffer, BufferCoord coord);
@ -202,7 +201,7 @@ private:
Flags m_flags; Flags m_flags;
struct Modification; struct Modification;
typedef std::vector<Modification> UndoGroup; using UndoGroup = std::vector<Modification>;
friend class UndoGroupOptimizer; friend class UndoGroupOptimizer;
std::vector<UndoGroup> m_history; std::vector<UndoGroup> m_history;

View File

@ -1,17 +1,18 @@
#ifndef completion_hh_INCLUDED #ifndef completion_hh_INCLUDED
#define completion_hh_INCLUDED #define completion_hh_INCLUDED
#include "string.hh"
#include <vector> #include <vector>
#include <functional> #include <functional>
#include "units.hh"
namespace Kakoune namespace Kakoune
{ {
class Context; class Context;
typedef std::vector<String> CandidateList; class String;
using CandidateList = std::vector<String>;
struct Completions struct Completions
{ {

View File

@ -18,7 +18,7 @@ struct DisplayCoord : LineAndColumn<DisplayCoord, LineCount, CharCount>
: LineAndColumn(line, column) {} : LineAndColumn(line, column) {}
}; };
typedef char Attribute; using Attribute = char;
enum Attributes enum Attributes
{ {

View File

@ -20,12 +20,10 @@ class Context;
// color, adding information text (line numbering for example) or replacing // color, adding information text (line numbering for example) or replacing
// buffer content (folding for example) // buffer content (folding for example)
typedef std::function<void (const Context& context, DisplayBuffer& display_buffer)> HighlighterFunc; using HighlighterFunc = std::function<void (const Context& context, DisplayBuffer& display_buffer)>;
typedef std::pair<String, HighlighterFunc> HighlighterAndId; using HighlighterAndId = std::pair<String, HighlighterFunc>;
typedef memoryview<String> HighlighterParameters; using HighlighterParameters = memoryview<String>;
using HighlighterFactory = std::function<HighlighterAndId (HighlighterParameters params)>; using HighlighterFactory = std::function<HighlighterAndId (HighlighterParameters params)>;
using HighlighterGroup = FunctionGroup<const Context&, DisplayBuffer&>; using HighlighterGroup = FunctionGroup<const Context&, DisplayBuffer&>;
struct HighlighterRegistry : FunctionRegistry<HighlighterFactory>, struct HighlighterRegistry : FunctionRegistry<HighlighterFactory>,

View File

@ -10,7 +10,7 @@ namespace Kakoune
{ {
class Context; class Context;
typedef std::function<void (const String&, Context&)> HookFunc; using HookFunc = std::function<void (const String&, Context&)>;
class HookManager class HookManager
{ {

View File

@ -13,10 +13,10 @@ template<typename Value>
class id_map class id_map
{ {
public: public:
typedef std::pair<String, Value> value_type; using value_type = std::pair<String, Value>;
typedef std::vector<value_type> container_type; using container_type = std::vector<value_type>;
typedef typename container_type::iterator iterator; using iterator = typename container_type::iterator;
typedef typename container_type::const_iterator const_iterator; using const_iterator = typename container_type::const_iterator;
void append(const value_type& value) void append(const value_type& value)
{ {

View File

@ -64,7 +64,7 @@ struct Key
{ return modifiers != other.modifiers or key != other.key; } { return modifiers != other.modifiers or key != other.key; }
}; };
typedef std::vector<Key> KeyList; using KeyList = std::vector<Key>;
KeyList parse_keys(const String& str); KeyList parse_keys(const String& str);
String key_to_str(Key key); String key_to_str(Key key);

View File

@ -74,11 +74,11 @@ struct ParametersParser
struct iterator struct iterator
{ {
public: public:
typedef String value_type; using value_type = String;
typedef const value_type* pointer; using pointer = const value_type*;
typedef const value_type& reference; using reference = const value_type&;
typedef size_t difference_type; using difference_type = size_t;
typedef std::forward_iterator_tag iterator_category; using iterator_category = std::forward_iterator_tag;
iterator(const ParametersParser& parser, size_t index) iterator(const ParametersParser& parser, size_t index)
: m_parser(parser), m_index(index) {} : m_parser(parser), m_index(index) {}

View File

@ -11,7 +11,7 @@
namespace Kakoune namespace Kakoune
{ {
typedef std::function<std::vector<String> (const Context&)> RegisterRetriever; using RegisterRetriever = std::function<std::vector<String> (const Context&)>;
class RegisterManager : public Singleton<RegisterManager> class RegisterManager : public Singleton<RegisterManager>
{ {

View File

@ -56,7 +56,7 @@ inline Range utf8_range(const Utf8Iterator& first, const Utf8Iterator& last)
return {first.base().coord(), last.base().coord()}; return {first.base().coord(), last.base().coord()};
} }
typedef boost::regex_iterator<BufferIterator> RegexIterator; using RegexIterator = boost::regex_iterator<BufferIterator>;
template<WordType word_type> template<WordType word_type>
Selection select_to_next_word(const Buffer& buffer, const Selection& selection) Selection select_to_next_word(const Buffer& buffer, const Selection& selection)

View File

@ -10,8 +10,8 @@ namespace Kakoune
{ {
struct Context; struct Context;
typedef std::function<String (const String& name, const Context&)> EnvVarRetriever; using EnvVarRetriever = std::function<String (const String& name, const Context&)>;
typedef std::unordered_map<String, String> EnvVarMap; using EnvVarMap = std::unordered_map<String, String>;
class ShellManager : public Singleton<ShellManager> class ShellManager : public Singleton<ShellManager>
{ {

View File

@ -11,7 +11,7 @@
namespace Kakoune namespace Kakoune
{ {
typedef boost::regex Regex; using Regex = boost::regex;
class String : public std::string class String : public std::string
{ {