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
|
||||
* 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.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
* @file: nana/gui/place.cpp
|
||||
* @file nana/gui/place.cpp
|
||||
*
|
||||
* @contributions:
|
||||
* min/max and splitter bar initial weight by Ariel Vina-Rodriguez.
|
||||
* @contributions
|
||||
* error, width/height, min/max and splitter bar initial weight by Ariel Vina-Rodriguez.
|
||||
*/
|
||||
|
||||
#ifndef NANA_GUI_PLACE_HPP
|
||||
@ -104,23 +104,29 @@ namespace nana
|
||||
virtual void _m_add_agent(const detail::place_agent&) = 0;
|
||||
};
|
||||
public:
|
||||
class error :public ::std::invalid_argument
|
||||
class error :public std::invalid_argument
|
||||
{
|
||||
public:
|
||||
error(::std::string what,
|
||||
error( const std::string& what,
|
||||
const place& plc,
|
||||
std::string field = "unknown",
|
||||
std::string::size_type pos = std::string::npos)
|
||||
|
||||
: std::invalid_argument(what),
|
||||
owner_caption{ API::window_caption(plc.window_handle()).substr(0,80) },
|
||||
field{ field },
|
||||
div_text{ plc.div() },
|
||||
pos{ pos }
|
||||
: 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) },
|
||||
field { field },
|
||||
div_text { plc.div() },
|
||||
pos { pos }
|
||||
{}
|
||||
std::string owner_caption; ///< truncate caption (title) of the "placed" widget
|
||||
std::string div_text;
|
||||
std::string field; ///< posible field where the error ocurred.
|
||||
std::string base_what;
|
||||
std::string owner_caption; ///< truncate caption (title) of the "placed" widget
|
||||
std::string div_text; ///< involved div_text
|
||||
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
|
||||
};
|
||||
/// reference to a field manipulator which refers to a field object created by place
|
||||
@ -139,8 +145,8 @@ namespace nana
|
||||
|
||||
void splitter_renderer(std::function<void(window, paint::graphics&, mouse_action)> fn);
|
||||
|
||||
void div(std::string div_text); ///< Divides the attached widget into fields.
|
||||
const std::string& div() const noexcept; ///< Returns div-text that depends on fields status.
|
||||
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.
|
||||
static bool valid_field_name(const char* name) ///< must begin with _a-zA-Z
|
||||
{
|
||||
return name && (*name == '_' || (('a' <= *name && *name <= 'z') || ('A' <= *name && *name <= 'Z')));
|
||||
|
||||
@ -59,8 +59,7 @@ namespace nana
|
||||
error(std::string what,
|
||||
const tokenizer& tok)
|
||||
|
||||
: std::invalid_argument{ what + " from tokenizer at position "
|
||||
+ std::to_string(static_cast<unsigned>(tok.sp_ - tok.divstr_)) },
|
||||
: std::invalid_argument{ what + " from tokenizer " },
|
||||
pos{static_cast<std::string::size_type>(tok.sp_ - tok.divstr_)}
|
||||
{}
|
||||
std::string::size_type pos;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user