Navigation Menu

Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
alabuzhev committed Jun 25, 2017
1 parent 51057a1 commit d68cc71
Show file tree
Hide file tree
Showing 70 changed files with 130 additions and 134 deletions.
2 changes: 1 addition & 1 deletion far/DlgBuilder.hpp
Expand Up @@ -105,7 +105,7 @@ struct RadioButtonBinding: public DialogItemBinding<T>
int *Value;

public:
RadioButtonBinding(int *aValue) : Value(aValue) { }
explicit RadioButtonBinding(int *aValue) : Value(aValue) { }

virtual void SaveValue(T *Item, int RadioGroupIndex) override
{
Expand Down
12 changes: 6 additions & 6 deletions far/FarDlgBuilder.cpp
Expand Up @@ -45,7 +45,7 @@ struct EditFieldBinding: public DialogItemBinding<DialogItemEx>
{
T& TextValue;

EditFieldBinding(T& aTextValue)
explicit EditFieldBinding(T& aTextValue)
: TextValue(aTextValue)
{
}
Expand Down Expand Up @@ -94,7 +94,7 @@ template<class T>
struct EditFieldHexBinding: public DialogItemBinding<DialogItemEx>
{
public:
EditFieldHexBinding(T *aIntValue) : IntValue(aIntValue)
explicit EditFieldHexBinding(T *aIntValue) : IntValue(aIntValue)
{
Mask[0] = L'0';
Mask[1] = L'x';
Expand Down Expand Up @@ -126,7 +126,7 @@ struct FarCheckBoxIntBinding: public DialogItemBinding<DialogItemEx>
int Mask;

public:
FarCheckBoxIntBinding(T& aValue, int aMask=0) : Value(aValue), Mask(aMask) { }
explicit FarCheckBoxIntBinding(T& aValue, int aMask=0) : Value(aValue), Mask(aMask) { }

virtual void SaveValue(DialogItemEx *Item, int RadioGroupIndex) override
{
Expand All @@ -151,7 +151,7 @@ struct FarCheckBoxBool3Binding: public DialogItemBinding<DialogItemEx>
T& Value;

public:
FarCheckBoxBool3Binding(T& aValue) : Value(aValue) { }
explicit FarCheckBoxBool3Binding(T& aValue) : Value(aValue) { }

virtual void SaveValue(DialogItemEx *Item, int RadioGroupIndex) override
{
Expand All @@ -166,7 +166,7 @@ struct FarCheckBoxBoolBinding: public DialogItemBinding<DialogItemEx>
T& Value;

public:
FarCheckBoxBoolBinding(T& aValue) : Value(aValue) { }
explicit FarCheckBoxBoolBinding(T& aValue) : Value(aValue) { }

virtual void SaveValue(DialogItemEx *Item, int RadioGroupIndex) override
{
Expand Down Expand Up @@ -218,7 +218,7 @@ struct FarRadioButtonBinding: public DialogItemBinding<DialogItemEx>
T& Value;

public:
FarRadioButtonBinding(T& aValue) : Value(aValue) { }
explicit FarRadioButtonBinding(T& aValue) : Value(aValue) { }

virtual void SaveValue(DialogItemEx *Item, int RadioGroupIndex) override
{
Expand Down
2 changes: 1 addition & 1 deletion far/FarDlgBuilder.hpp
Expand Up @@ -114,7 +114,7 @@ struct ListControlBinding: public DialogItemBinding<T>
class DialogBuilder: noncopyable, public base<DialogBuilderBase<DialogItemEx>>
{
public:
DialogBuilder(lng TitleMessageId, const wchar_t *HelpTopic = nullptr, Dialog::dialog_handler handler = nullptr);
explicit DialogBuilder(lng TitleMessageId, const wchar_t *HelpTopic = nullptr, Dialog::dialog_handler handler = nullptr);
DialogBuilder();
~DialogBuilder();

Expand Down
19 changes: 8 additions & 11 deletions far/PluginA.cpp
Expand Up @@ -96,7 +96,7 @@ DECLARE_PLUGIN_FUNCTION(iProcessDialogEvent, int (WINAPI*)(int Event, void *
class file_version: noncopyable
{
public:
file_version(const string& File):
explicit file_version(const string& File):
m_File(File)
{
}
Expand Down Expand Up @@ -148,7 +148,8 @@ class oem_plugin_module: public native_plugin_module
{
public:
NONCOPYABLE(oem_plugin_module);
oem_plugin_module(const string& Name):

explicit oem_plugin_module(const string& Name):
native_plugin_module(Name),
m_FileVersion(Name)
{
Expand All @@ -161,7 +162,8 @@ class oem_plugin_factory: public native_plugin_factory
{
public:
NONCOPYABLE(oem_plugin_factory);
oem_plugin_factory(PluginManager* Owner):

explicit oem_plugin_factory(PluginManager* Owner):
native_plugin_factory(Owner)
{
static const export_name ExportsNames[] =
Expand Down Expand Up @@ -1163,11 +1165,7 @@ static void FreeUnicodeDialogItem(FarDialogItem &di)
{
if (di.ListItems->Items)
{
for (size_t i = 0; i < di.ListItems->ItemsNumber; i++)
{
delete[] di.ListItems->Items[i].Text;
}

std::for_each(di.ListItems->Items, di.ListItems->Items + di.ListItems->ItemsNumber, [](const FarListItem& i) { delete[] i.Text; });
delete[] di.ListItems->Items;
di.ListItems->Items = nullptr;
}
Expand Down Expand Up @@ -3215,8 +3213,7 @@ static intptr_t WINAPI FarSendDlgMessageA(HANDLE hDlg, int OldMsg, int Param1, v

if (newlist.Items)
{
for (size_t i=0; i<newlist.ItemsNumber; i++)
delete[] newlist.Items[i].Text;
std::for_each(newlist.Items, newlist.Items + newlist.ItemsNumber, [](const FarListItem& i) { delete[] i.Text; });
delete[] newlist.Items;
}

Expand Down Expand Up @@ -5925,7 +5922,7 @@ class PluginA: public Plugin
class ansi_plugin_language final: public language
{
public:
ansi_plugin_language(const string& Path):
explicit ansi_plugin_language(const string& Path):
language(m_Data),
m_Data(std::make_unique<ansi_language_data>())
{
Expand Down
4 changes: 2 additions & 2 deletions far/TPreRedrawFunc.hpp
Expand Up @@ -40,7 +40,7 @@ struct PreRedrawItem: noncopyable
{
using handler_type = std::function<void()>;

PreRedrawItem(const handler_type& PreRedrawFunc) : m_PreRedrawFunc(PreRedrawFunc) {}
explicit PreRedrawItem(const handler_type& PreRedrawFunc) : m_PreRedrawFunc(PreRedrawFunc) {}
virtual ~PreRedrawItem() = default;

handler_type m_PreRedrawFunc;
Expand Down Expand Up @@ -70,7 +70,7 @@ inline TPreRedrawFunc& PreRedrawStack()
class TPreRedrawFuncGuard: noncopyable
{
public:
TPreRedrawFuncGuard(std::unique_ptr<PreRedrawItem>&& Item)
explicit TPreRedrawFuncGuard(std::unique_ptr<PreRedrawItem>&& Item)
{
PreRedrawStack().push(std::move(Item));
}
Expand Down
2 changes: 1 addition & 1 deletion far/TaskBar.hpp
Expand Up @@ -59,7 +59,7 @@ taskbar& Taskbar();
class IndeterminateTaskBar: noncopyable
{
public:
IndeterminateTaskBar(bool EndFlash = true);
explicit IndeterminateTaskBar(bool EndFlash = true);
~IndeterminateTaskBar();

private:
Expand Down
2 changes: 1 addition & 1 deletion far/bitflags.hpp
Expand Up @@ -40,7 +40,7 @@ class TBitFlags
{
public:
TBitFlags():m_Flags(0) {}
TBitFlags(const T& Flags):m_Flags(Flags) {}
explicit TBitFlags(const T& Flags):m_Flags(Flags) {}

const T& Flags() const { return m_Flags; }
// установить набор флагов
Expand Down
2 changes: 1 addition & 1 deletion far/blob_builder.hpp
Expand Up @@ -38,7 +38,7 @@ class blob_builder
public:
NONCOPYABLE(blob_builder);

blob_builder(uintptr_t CodePage):
explicit blob_builder(uintptr_t CodePage):
m_CodePage(CodePage),
m_Signature(IsUnicodeOrUtfCodePage(m_CodePage))
{
Expand Down
4 changes: 2 additions & 2 deletions far/cache.hpp
Expand Up @@ -37,7 +37,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
class CachedRead: noncopyable
{
public:
CachedRead(os::fs::file& file, size_t buffer_size = 0);
explicit CachedRead(os::fs::file& file, size_t buffer_size = 0);
void AdjustAlignment(); // file have to be opened already
bool Read(void* Data, size_t DataSize, size_t* BytesRead);
bool FillBuffer();
Expand All @@ -57,7 +57,7 @@ class CachedRead: noncopyable
class CachedWrite: noncopyable
{
public:
CachedWrite(os::fs::file& file);
explicit CachedWrite(os::fs::file& file);
~CachedWrite();
bool Write(const void* Data, size_t DataSize);
bool Flush();
Expand Down
4 changes: 4 additions & 0 deletions far/changelog
@@ -1,3 +1,7 @@
drkns 25.06.2017 02:03:37 +0000 - build 4979

1. Рефакторинг.

drkns 23.06.2017 16:48:00 +0000 - build 4978

1. С форума: ненужный запрос привилегий
Expand Down
2 changes: 1 addition & 1 deletion far/chgprior.hpp
Expand Up @@ -38,7 +38,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
class ChangePriority: noncopyable
{
public:
ChangePriority(int NewPriority);
explicit ChangePriority(int NewPriority);
~ChangePriority();

private:
Expand Down
2 changes: 1 addition & 1 deletion far/clipboard.hpp
Expand Up @@ -91,7 +91,7 @@ class Clipboard
class clipboard_accessor:noncopyable
{
public:
clipboard_accessor(clipboard_mode Mode = default_clipboard_mode::get()): m_Clipboard(Clipboard::GetInstance(Mode)) {}
explicit clipboard_accessor(clipboard_mode Mode = default_clipboard_mode::get()): m_Clipboard(Clipboard::GetInstance(Mode)) {}
~clipboard_accessor() { m_Clipboard.Close(); }
auto operator->() const { return &m_Clipboard; }

Expand Down
2 changes: 1 addition & 1 deletion far/cmdline.hpp
Expand Up @@ -66,7 +66,7 @@ class i_execution_context
class CommandLine:public SimpleScreenObject
{
public:
CommandLine(window_ptr Owner);
explicit CommandLine(window_ptr Owner);
virtual ~CommandLine() override;

virtual bool ProcessKey(const Manager::Key& Key) override;
Expand Down
2 changes: 1 addition & 1 deletion far/codepage_selection.hpp
Expand Up @@ -113,7 +113,7 @@ codepages& Codepages();
class F8CP
{
public:
F8CP(bool viewer = false);
explicit F8CP(bool viewer = false);

uintptr_t NextCP(uintptr_t cp) const;
const string& NextCPname(uintptr_t cp) const;
Expand Down
2 changes: 1 addition & 1 deletion far/common/any.hpp
Expand Up @@ -46,7 +46,7 @@ namespace detail
{
public:
template<class Y>
any_impl(Y&& Data):
explicit any_impl(Y&& Data):
m_Data(std::forward<Y>(Data))
{
}
Expand Down
2 changes: 1 addition & 1 deletion far/common/enumerator.hpp
Expand Up @@ -106,7 +106,7 @@ class inline_enumerator: public enumerator<inline_enumerator<value_type, callabl
IMPLEMENTS_ENUMERATOR(inline_enumerator);

public:
inline_enumerator(callable&& Callable):
explicit inline_enumerator(callable&& Callable):
m_Callable(std::forward<callable>(Callable))
{
}
Expand Down
2 changes: 1 addition & 1 deletion far/common/null_iterator.hpp
Expand Up @@ -38,7 +38,7 @@ class null_iterator_t:
public rel_ops<null_iterator_t<T>>
{
public:
null_iterator_t(T* Data): m_Data(Data) {}
explicit null_iterator_t(T* Data): m_Data(Data) {}
auto& operator++() { ++m_Data; return *this; }
auto operator++(int) { return null_iterator_t(m_Data++); }
auto& operator*() { return *m_Data; }
Expand Down
2 changes: 1 addition & 1 deletion far/common/range.hpp
Expand Up @@ -107,7 +107,7 @@ class i_iterator: public std::iterator<std::random_access_iterator_tag, T>, publ
public:
using value_type = T;

i_iterator(const T& value): m_value(value) {}
explicit i_iterator(const T& value): m_value(value) {}
i_iterator(const i_iterator& rhs): m_value(rhs.m_value) {}

auto& operator=(const i_iterator& rhs) { m_value = rhs.m_value; return *this; }
Expand Down
4 changes: 2 additions & 2 deletions far/common/smart_ptr.hpp
Expand Up @@ -40,7 +40,7 @@ class array_ptr: public conditional<array_ptr<T>>
MOVABLE(array_ptr);

array_ptr() noexcept: m_size() {}
array_ptr(size_t size, bool init = false) { reset(size, init); }
explicit array_ptr(size_t size, bool init = false) { reset(size, init); }

void reset(size_t size, bool init = false) { m_array.reset(init? new T[size]() : new T[size]); m_size = size;}
void reset() noexcept { m_array.reset(); m_size = 0; }
Expand Down Expand Up @@ -107,7 +107,7 @@ class ptr_setter_t
public:
NONCOPYABLE(ptr_setter_t)
MOVABLE(ptr_setter_t)
ptr_setter_t(T& Ptr): m_Ptr(&Ptr) {}
explicit ptr_setter_t(T& Ptr): m_Ptr(&Ptr) {}
~ptr_setter_t() { if (m_Ptr) m_Ptr->reset(m_RawPtr); }
auto operator&() { return &m_RawPtr; }

Expand Down
4 changes: 2 additions & 2 deletions far/common/zip_view.hpp
Expand Up @@ -106,7 +106,7 @@ class zip_iterator:
{
public:
zip_iterator() = default;
zip_iterator(const args&... Args): m_Tuple(Args...) {}
explicit zip_iterator(const args&... Args): m_Tuple(Args...) {}
auto& operator++() { detail::traits<args...>::unary_for_each(detail::increment{}, m_Tuple); return *this; }
auto& operator--() { detail::traits<args...>::unary_for_each(detail::decrement{}, m_Tuple); return *this; }
// tuple's operators == and < are inappropriate as ranges might be of different length and we want to stop on a shortest one
Expand All @@ -125,7 +125,7 @@ class zip_view
public:
using iterator = zip_iterator<decltype(std::begin(std::declval<args>()))...>;

zip_view(args&&... Args):
explicit zip_view(args&&... Args):
m_Begin(std::begin(Args)...),
m_End(std::end(Args)...)
{
Expand Down
2 changes: 1 addition & 1 deletion far/components.hpp
Expand Up @@ -42,7 +42,7 @@ namespace components
using info = std::pair<string, string>;
using get_info = info(*)();

component(get_info getInfo);
explicit component(get_info getInfo);

private:
friend class components_list;
Expand Down
2 changes: 1 addition & 1 deletion far/config.hpp
Expand Up @@ -121,7 +121,7 @@ class Option

protected:
template<class T>
Option(const T& Value): m_Value(Value) {}
explicit Option(const T& Value): m_Value(Value) {}

template<class T>
const T& GetT() const { return any_cast<T>(m_Value); }
Expand Down
2 changes: 1 addition & 1 deletion far/configdb.cpp
Expand Up @@ -51,7 +51,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
class representation_source
{
public:
representation_source(const string& File):
explicit representation_source(const string& File):
m_File(File),
m_Root(nullptr)
{
Expand Down
5 changes: 3 additions & 2 deletions far/configdb.hpp
Expand Up @@ -107,7 +107,7 @@ class HierarchicalConfig: public representable, virtual public transactional, pu
private:
friend class HierarchicalConfig;

key(unsigned long long Key): m_Key(Key) {}
explicit key(unsigned long long Key): m_Key(Key) {}
unsigned long long m_Key;
};

Expand Down Expand Up @@ -369,7 +369,8 @@ class config_provider: noncopyable
{
public:
enum class mode { m_default, m_import, m_export };
config_provider(mode Mode = mode::m_default);

explicit config_provider(mode Mode = mode::m_default);
~config_provider();
bool ShowProblems() const;
bool ServiceMode(const string& File);
Expand Down
2 changes: 1 addition & 1 deletion far/delete.hpp
Expand Up @@ -64,7 +64,7 @@ bool DeleteFileWithFolder(const string& FileName);
class delayed_deleter: noncopyable
{
public:
delayed_deleter(const string& pathToDelete);
explicit delayed_deleter(const string& pathToDelete);
~delayed_deleter();

private:
Expand Down
2 changes: 1 addition & 1 deletion far/desktop.hpp
Expand Up @@ -42,7 +42,7 @@ class desktop: public window

public:
static desktop_ptr create();
desktop(private_tag);
explicit desktop(private_tag);

virtual int GetType() const override { return windowtype_desktop; }
virtual int GetTypeAndName(string& Type, string& Name) override { Type = GetTitle(); return GetType(); }
Expand Down
2 changes: 1 addition & 1 deletion far/diskmenu.cpp
Expand Up @@ -623,7 +623,7 @@ static int ChangeDiskMenu(panel_ptr Owner, int Pos, bool FirstCall)
class Guard_Macro_DskShowPosType //фигня какая-то
{
public:
Guard_Macro_DskShowPosType(panel_ptr curPanel) { Global->Macro_DskShowPosType = curPanel->Parent()->IsLeft(curPanel)? 1 : 2; }
explicit Guard_Macro_DskShowPosType(panel_ptr curPanel) { Global->Macro_DskShowPosType = curPanel->Parent()->IsLeft(curPanel)? 1 : 2; }
~Guard_Macro_DskShowPosType() { Global->Macro_DskShowPosType = 0; }
};
SCOPED_ACTION(Guard_Macro_DskShowPosType)(Owner);
Expand Down
2 changes: 1 addition & 1 deletion far/dizviewer.hpp
Expand Up @@ -42,7 +42,7 @@ class DizViewer: public Viewer
int InRecursion;

public:
DizViewer(window_ptr Owner):Viewer(Owner), InRecursion(0) {}
explicit DizViewer(window_ptr Owner):Viewer(Owner), InRecursion(0) {}

public:
virtual bool ProcessKey(const Manager::Key& Key) override
Expand Down

0 comments on commit d68cc71

Please sign in to comment.