full error msg at one place
This commit is contained in:
parent
7830f430c0
commit
1d2e489c7f
@ -1,16 +1,16 @@
|
|||||||
/*
|
/**
|
||||||
* An Implementation of Place for Layout
|
* An Implementation of Place for Layout
|
||||||
* Nana C++ Library(http://www.nanapro.org)
|
* Nana C++ Library(http://www.nanapro.org)
|
||||||
* Copyright(C) 2003-2018 Jinhao(cnjinhao@hotmail.com)
|
* Copyright(C) 2003-2019 Jinhao(cnjinhao@hotmail.com)
|
||||||
*
|
*
|
||||||
* Distributed under the Boost Software License, Version 1.0.
|
* Distributed under the Boost Software License, Version 1.0.
|
||||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
* http://www.boost.org/LICENSE_1_0.txt)
|
* http://www.boost.org/LICENSE_1_0.txt)
|
||||||
*
|
*
|
||||||
* @file: nana/gui/place.cpp
|
* @file nana/gui/place.cpp
|
||||||
*
|
*
|
||||||
* @contributions:
|
* @contributions
|
||||||
* min/max and splitter bar initial weight by Ariel Vina-Rodriguez.
|
* error, width/height, min/max and splitter bar initial weight by Ariel Vina-Rodriguez.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef NANA_GUI_PLACE_HPP
|
#ifndef NANA_GUI_PLACE_HPP
|
||||||
@ -104,22 +104,28 @@ namespace nana
|
|||||||
virtual void _m_add_agent(const detail::place_agent&) = 0;
|
virtual void _m_add_agent(const detail::place_agent&) = 0;
|
||||||
};
|
};
|
||||||
public:
|
public:
|
||||||
class error :public ::std::invalid_argument
|
class error :public std::invalid_argument
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
error(::std::string what,
|
error( const std::string& what,
|
||||||
const place& plc,
|
const place& plc,
|
||||||
std::string field = "unknown",
|
std::string field = "unknown",
|
||||||
std::string::size_type pos = std::string::npos)
|
std::string::size_type pos = std::string::npos)
|
||||||
|
|
||||||
: std::invalid_argument(what),
|
: std::invalid_argument{ "Place error " + what
|
||||||
|
+ " from widget " + API::window_caption(plc.window_handle()).substr(0,80)
|
||||||
|
+ " in fleld " + field
|
||||||
|
+ ( pos == std::string::npos ? "" : "at at position " + std::to_string(pos) )
|
||||||
|
+ "in div_text:\n" + plc.div()},
|
||||||
|
base_what { what },
|
||||||
owner_caption{ API::window_caption(plc.window_handle()).substr(0,80) },
|
owner_caption{ API::window_caption(plc.window_handle()).substr(0,80) },
|
||||||
field{ field },
|
field { field },
|
||||||
div_text{ plc.div() },
|
div_text { plc.div() },
|
||||||
pos{ pos }
|
pos { pos }
|
||||||
{}
|
{}
|
||||||
|
std::string base_what;
|
||||||
std::string owner_caption; ///< truncate caption (title) of the "placed" widget
|
std::string owner_caption; ///< truncate caption (title) of the "placed" widget
|
||||||
std::string div_text;
|
std::string div_text; ///< involved div_text
|
||||||
std::string field; ///< posible field where the error ocurred.
|
std::string field; ///< posible field where the error ocurred.
|
||||||
std::string::size_type pos; ///< posible position in the div_text where the error ocurred. npos if unknown
|
std::string::size_type pos; ///< posible position in the div_text where the error ocurred. npos if unknown
|
||||||
};
|
};
|
||||||
@ -139,7 +145,7 @@ namespace nana
|
|||||||
|
|
||||||
void splitter_renderer(std::function<void(window, paint::graphics&, mouse_action)> fn);
|
void splitter_renderer(std::function<void(window, paint::graphics&, mouse_action)> fn);
|
||||||
|
|
||||||
void div(std::string div_text); ///< Divides the attached widget into fields.
|
void div(std::string div_text); ///< Divides the attached widget into fields. May throw placa::error
|
||||||
const std::string& div() const noexcept; ///< Returns div-text that depends on fields status.
|
const std::string& div() const noexcept; ///< Returns div-text that depends on fields status.
|
||||||
static bool valid_field_name(const char* name) ///< must begin with _a-zA-Z
|
static bool valid_field_name(const char* name) ///< must begin with _a-zA-Z
|
||||||
{
|
{
|
||||||
|
|||||||
@ -59,8 +59,7 @@ namespace nana
|
|||||||
error(std::string what,
|
error(std::string what,
|
||||||
const tokenizer& tok)
|
const tokenizer& tok)
|
||||||
|
|
||||||
: std::invalid_argument{ what + " from tokenizer at position "
|
: std::invalid_argument{ what + " from tokenizer " },
|
||||||
+ std::to_string(static_cast<unsigned>(tok.sp_ - tok.divstr_)) },
|
|
||||||
pos{static_cast<std::string::size_type>(tok.sp_ - tok.divstr_)}
|
pos{static_cast<std::string::size_type>(tok.sp_ - tok.divstr_)}
|
||||||
{}
|
{}
|
||||||
std::string::size_type pos;
|
std::string::size_type pos;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user