1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-18 08:51:46 +03:00

Cleanup includes

This commit is contained in:
Maxime Coste 2014-11-12 21:27:07 +00:00
parent 58c1721564
commit 3a817e2f96
26 changed files with 88 additions and 64 deletions

View File

@ -1,7 +1,6 @@
#ifndef alias_registry_hh_INCLUDED
#define alias_registry_hh_INCLUDED
#include "utils.hh"
#include "safe_ptr.hh"
#include "string.hh"

View File

@ -9,9 +9,6 @@
#include "value.hh"
#include <vector>
#include <list>
#include <memory>
#include <unordered_set>
namespace Kakoune
{

View File

@ -5,7 +5,6 @@
#include "env_vars.hh"
#include "input_handler.hh"
#include "safe_ptr.hh"
#include "string.hh"
#include "utils.hh"
#include "option_manager.hh"
@ -14,6 +13,7 @@ namespace Kakoune
class UserInterface;
class Window;
class String;
class Client : public SafeCountable, public OptionManagerWatcher
{

View File

@ -3,6 +3,8 @@
#include "exception.hh"
#include "regex.hh"
#include <cstdio>
namespace Kakoune
{

View File

@ -1,8 +1,6 @@
#ifndef color_hh_INCLUDED
#define color_hh_INCLUDED
#include <utility>
namespace Kakoune
{

View File

@ -3,6 +3,7 @@
#include "assert.hh"
#include "buffer.hh"
#include "buffer_manager.hh"
#include "string.hh"
namespace Kakoune
{

View File

@ -1,11 +1,11 @@
#ifndef debug_hh_INCLUDED
#define debug_hh_INCLUDED
#include "string.hh"
namespace Kakoune
{
class StringView;
void write_debug(StringView str);
}

View File

@ -1,10 +1,48 @@
#include "display_buffer.hh"
#include "assert.hh"
#include "buffer.hh"
#include "utf8.hh"
namespace Kakoune
{
StringView DisplayAtom::content() const
{
switch (m_type)
{
case BufferRange:
{
auto line = (*m_buffer)[m_begin.line];
if (m_begin.line == m_end.line)
return line.substr(m_begin.column, m_end.column - m_begin.column);
else if (m_begin.line+1 == m_end.line and m_end.column == 0)
return line.substr(m_begin.column);
break;
}
case Text:
case ReplacedBufferRange:
return m_text;
}
kak_assert(false);
return {};
}
CharCount DisplayAtom::length() const
{
switch (m_type)
{
case BufferRange:
return utf8::distance(m_buffer->iterator_at(m_begin),
m_buffer->iterator_at(m_end));
case Text:
case ReplacedBufferRange:
return m_text.char_length();
}
kak_assert(false);
return 0;
}
void DisplayAtom::trim_begin(CharCount count)
{
if (m_type == BufferRange)

View File

@ -1,17 +1,17 @@
#ifndef display_buffer_hh_INCLUDED
#define display_buffer_hh_INCLUDED
#include "buffer.hh"
#include "face.hh"
#include "coord.hh"
#include "string.hh"
#include "utf8.hh"
#include <vector>
namespace Kakoune
{
class Buffer;
struct DisplayAtom
{
public:
@ -25,41 +25,8 @@ public:
: m_type(Text), m_text(std::move(str)), face(face)
{ check_invariant(); }
StringView content() const
{
switch (m_type)
{
case BufferRange:
{
auto line = (*m_buffer)[m_begin.line];
if (m_begin.line == m_end.line)
return line.substr(m_begin.column, m_end.column - m_begin.column);
else if (m_begin.line+1 == m_end.line and m_end.column == 0)
return line.substr(m_begin.column);
break;
}
case Text:
case ReplacedBufferRange:
return m_text;
}
kak_assert(false);
return {};
}
CharCount length() const
{
switch (m_type)
{
case BufferRange:
return utf8::distance(m_buffer->iterator_at(m_begin),
m_buffer->iterator_at(m_end));
case Text:
case ReplacedBufferRange:
return m_text.char_length();
}
kak_assert(false);
return 0;
}
StringView content() const;
CharCount length() const;
const ByteCoord& begin() const
{

View File

@ -1,5 +1,7 @@
#include "env_vars.hh"
#include "string.hh"
extern char **environ;
namespace Kakoune

View File

@ -1,13 +1,12 @@
#ifndef env_vars_hh_INCLUDED
#define env_vars_hh_INCLUDED
#include "string.hh"
#include <unordered_map>
namespace Kakoune
{
class String;
using EnvVarMap = std::unordered_map<String, String>;
EnvVarMap get_env_vars();
@ -15,4 +14,3 @@ EnvVarMap get_env_vars();
}
#endif // env_vars_hh_INCLUDED

View File

@ -8,6 +8,7 @@
#include "debug.hh"
#include "unicode.hh"
#include "regex.hh"
#include "string.hh"
#include <errno.h>
#include <sys/types.h>

View File

@ -2,7 +2,6 @@
#define file_hh_INCLUDED
#include "exception.hh"
#include "string.hh"
#include "regex.hh"
namespace Kakoune
@ -23,6 +22,9 @@ struct file_not_found : file_access_error
};
class Buffer;
template<typename T> class memoryview;
class String;
class StringView;
// parse ~/ and $env values in filename and returns the translated filename
String parse_filename(StringView filename);

View File

@ -2,7 +2,6 @@
#define hook_manager_hh_INCLUDED
#include "id_map.hh"
#include "utils.hh"
#include <unordered_map>

View File

@ -1,5 +1,7 @@
#include "keymap_manager.hh"
#include "memoryview.hh"
namespace std
{

View File

@ -5,6 +5,7 @@
#include "utils.hh"
#include <unordered_map>
#include <vector>
namespace Kakoune
{
@ -20,6 +21,8 @@ enum class KeymapMode : int
View,
};
template<typename T> class memoryview;
class KeymapManager
{
public:

View File

@ -1,8 +1,8 @@
#ifndef keys_hh_INCLUDED
#define keys_hh_INCLUDED
#include "string.hh"
#include "unicode.hh"
#include "flags.hh"
#include <vector>
@ -64,8 +64,13 @@ struct Key
{ return modifiers != other.modifiers or key != other.key; }
};
template<> struct WithBitOps<Key::Modifiers> : std::true_type {};
using KeyList = std::vector<Key>;
class String;
class StringView;
KeyList parse_keys(StringView str);
String key_to_str(Key key);
@ -79,7 +84,7 @@ namespace std
{
template<>
struct hash<Kakoune::Key> : unary_function<const Kakoune::Key&, size_t>
struct hash<Kakoune::Key>
{
size_t operator()(Kakoune::Key key) const
{

View File

@ -2,6 +2,7 @@
#include "display_buffer.hh"
#include "event_manager.hh"
#include "keys.hh"
#include "register_manager.hh"
#include "utf8_iterator.hh"

View File

@ -1,8 +1,9 @@
#ifndef ncurses_hh_INCLUDED
#define ncurses_hh_INCLUDED
#include "display_buffer.hh"
#include "coord.hh"
#include "event_manager.hh"
#include "face.hh"
#include "user_interface.hh"
namespace Kakoune

View File

@ -5,6 +5,7 @@
#include "string.hh"
#include "units.hh"
#include "coord.hh"
#include "memoryview.hh"
#include <tuple>
#include <vector>

View File

@ -1,9 +1,13 @@
#ifndef remote_hh_INCLUDED
#define remote_hh_INCLUDED
#include "display_buffer.hh"
#include "user_interface.hh"
#include "coord.hh"
#include "env_vars.hh"
#include "exception.hh"
#include "user_interface.hh"
#include "utils.hh"
#include <memory>
namespace Kakoune
{

View File

@ -1,7 +1,6 @@
#ifndef shell_manager_hh_INCLUDED
#define shell_manager_hh_INCLUDED
#include "string.hh"
#include "regex.hh"
#include "utils.hh"
#include "env_vars.hh"
@ -10,6 +9,10 @@ namespace Kakoune
{
class Context;
template<typename T> class memoryview;
class String;
class StringView;
using EnvVarRetriever = std::function<String (StringView name, const Context&)>;
class ShellManager : public Singleton<ShellManager>

View File

@ -1,13 +1,13 @@
#ifndef string_hh_INCLUDED
#define string_hh_INCLUDED
#include "memoryview.hh"
#include "units.hh"
#include "utf8.hh"
#include <string>
#include <climits>
#include <cstring>
#include <vector>
namespace Kakoune
{

View File

@ -1,11 +1,9 @@
#ifndef user_interface_hh_INCLUDED
#define user_interface_hh_INCLUDED
#include "color.hh"
#include "keys.hh"
#include "memoryview.hh"
#include "safe_ptr.hh"
#include <functional>
#include <unordered_map>
namespace Kakoune
@ -15,6 +13,9 @@ class String;
class DisplayBuffer;
class DisplayLine;
struct CharCoord;
struct Face;
struct Key;
template<typename T> class memoryview;
enum class MenuStyle
{

View File

@ -67,7 +67,7 @@ private:
struct ValueId : public StronglyTypedNumber<ValueId, int>
{
constexpr ValueId(int value = 0) : StronglyTypedNumber<ValueId>(value) {}
constexpr ValueId(int value = 0) : StronglyTypedNumber(value) {}
static ValueId get_free_id()
{

View File

@ -1,10 +1,9 @@
#ifndef window_hh_INCLUDED
#define window_hh_INCLUDED
#include "completion.hh"
#include "display_buffer.hh"
#include "highlighter_group.hh"
#include "selection.hh"
#include "option_manager.hh"
#include "safe_ptr.hh"
#include "scope.hh"