using empty instead of size

This commit is contained in:
fluxgen 2004-01-21 14:14:40 +00:00
parent 9c0272004e
commit 5e5118b4e3
8 changed files with 21 additions and 23 deletions

View file

@ -20,7 +20,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: FbCommandFactory.cc,v 1.25 2004/01/16 11:41:38 fluxgen Exp $
// $Id: FbCommandFactory.cc,v 1.26 2004/01/21 14:11:42 fluxgen Exp $
#include "FbCommandFactory.hh"
@ -252,9 +252,9 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command,
//
// Workspace commands
//
else if (command == "nextworkspace" && arguments.size() == 0)
else if (command == "nextworkspace" && arguments.empty())
return new NextWorkspaceCmd();
else if (command == "prevworkspace" && arguments.size() == 0)
else if (command == "prevworkspace" && arguments.empty())
return new PrevWorkspaceCmd();
else if (command == "rightworkspace")
return new RightWorkspaceCmd(atoi(arguments.c_str()));

View file

@ -19,7 +19,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: FbCommands.cc,v 1.22 2003/12/20 17:41:32 fluxgen Exp $
// $Id: FbCommands.cc,v 1.23 2004/01/21 14:11:15 fluxgen Exp $
#include "FbCommands.hh"
#include "fluxbox.hh"
@ -86,11 +86,10 @@ RestartFluxboxCmd::RestartFluxboxCmd(const std::string &cmd):m_cmd(cmd){
}
void RestartFluxboxCmd::execute() {
if (m_cmd.size() == 0) {
if (m_cmd.empty())
Fluxbox::instance()->restart();
} else {
else
Fluxbox::instance()->restart(m_cmd.c_str());
}
}
void ReconfigureFluxboxCmd::execute() {

View file

@ -19,7 +19,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: FbWinFrame.cc,v 1.70 2004/01/10 20:22:05 rathnor Exp $
// $Id: FbWinFrame.cc,v 1.71 2004/01/21 14:12:31 fluxgen Exp $
#include "FbWinFrame.hh"
@ -619,7 +619,7 @@ void FbWinFrame::configureNotifyEvent(XConfigureEvent &event) {
}
void FbWinFrame::reconfigure() {
if (m_labelbuttons.size() == 0)
if (m_labelbuttons.empty())
return;
m_bevel = theme().bevelWidth();
@ -717,15 +717,14 @@ unsigned int FbWinFrame::buttonHeight() const {
aligns and redraws title
*/
void FbWinFrame::redrawTitle() {
if (m_labelbuttons.size() == 0)
if (m_labelbuttons.empty())
return;
int button_width = label().width()/m_labelbuttons.size();
int rounding_error = label().width() - m_labelbuttons.size()*button_width;
//!! TODO: bevel
//int border_width = m_labelbuttons.front()->window().borderWidth();
int border_width = m_labelbuttons.size() != 0 ?
m_labelbuttons.front()->borderWidth() : 0;
int border_width = m_labelbuttons.empty() ? 0 : m_labelbuttons.front()->borderWidth();
LabelList::iterator btn_it = m_labelbuttons.begin();
LabelList::iterator btn_it_end = m_labelbuttons.end();
@ -799,7 +798,7 @@ void FbWinFrame::reconfigureTitlebar() {
// space left on titlebar between left and right buttons
unsigned int space_left = m_titlebar.width() - next_x;
if (m_buttons_right.size() != 0)
if (!m_buttons_right.empty())
space_left -= m_buttons_right.size() * (button_size + m_bevel);
space_left -= m_bevel;

View file

@ -22,7 +22,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: I18n.cc,v 1.5 2004/01/06 13:42:47 grubert Exp $
// $Id: I18n.cc,v 1.6 2004/01/21 14:12:51 fluxgen Exp $
//usr GNU extensions
#ifndef _GNU_SOURCE
@ -56,7 +56,7 @@ I18n::I18n():m_multibyte(false), m_catalog_fd((nl_catd)(-1)) {
//make sure we don't get 0 to m_locale string
char *temp = setlocale(LC_ALL, "");
m_locale = ( temp ? temp : "");
if (m_locale.size() == 0) {
if (m_locale.empty()) {
cerr<<"Warning: Failed to set locale, reverting to \"C\""<<endl;
#endif // HAVE_SETLOCALE

View file

@ -20,7 +20,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: IconButton.cc,v 1.16 2004/01/16 09:32:44 fluxgen Exp $
// $Id: IconButton.cc,v 1.17 2004/01/21 14:13:32 fluxgen Exp $
#include "IconButton.hh"
@ -161,7 +161,7 @@ void IconButton::update(FbTk::Subject *subj) {
// so we refresh everything
// we need to check our client first
if (m_win.clientList().size() == 0)
if (m_win.clientList().empty())
return;
XWMHints *hints = XGetWMHints(FbTk::App::instance()->display(), m_win.winClient().window());

View file

@ -20,7 +20,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: IconbarTool.cc,v 1.31 2004/01/19 18:28:08 fluxgen Exp $
// $Id: IconbarTool.cc,v 1.32 2004/01/21 14:13:57 fluxgen Exp $
#include "IconbarTool.hh"
@ -682,7 +682,7 @@ void IconbarTool::removeWindow(FluxboxWindow &win) {
void IconbarTool::addWindow(FluxboxWindow &win) {
// we just want windows that has clients
if (win.clientList().size() == 0)
if (win.clientList().empty())
return;
IconButton *button = new IconButton(m_icon_container, m_theme.focusedText().font(), win);

View file

@ -22,7 +22,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: Screen.cc,v 1.263 2004/01/19 22:07:24 fluxgen Exp $
// $Id: Screen.cc,v 1.264 2004/01/21 14:14:18 fluxgen Exp $
#include "Screen.hh"
@ -1980,7 +1980,7 @@ bool BScreen::parseMenuFile(ifstream &file, FbTk::Menu &menu, int &row) {
// perform shell style ~ home directory expansion
string newfile(FbTk::StringUtil::expandFilename(str_label));
if (newfile.size() != 0) {
if (!newfile.empty()) {
if (!FbTk::Directory::isRegularFile(newfile)) {
fprintf(stderr,
i18n->

View file

@ -22,7 +22,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: Workspace.cc,v 1.89 2003/12/30 18:16:51 fluxgen Exp $
// $Id: Workspace.cc,v 1.90 2004/01/21 14:14:40 fluxgen Exp $
#include "Workspace.hh"
@ -365,7 +365,7 @@ void Workspace::update(FbTk::Subject *subj) {
void Workspace::setName(const std::string &name) {
if (name.size() != 0) {
if (!name.empty()) {
m_name = name;
} else { //if name == 0 then set default name from nls
char tname[128];