Added Util.h, which contains only an ASSERT macro for now
This commit is contained in:
parent
0cfca85d27
commit
3dcebcf56c
7 changed files with 57 additions and 23 deletions
|
@ -39,8 +39,6 @@ distclean-local:
|
|||
|
||||
# local dependencies
|
||||
|
||||
Geometry.o: Geometry.cc Geometry.h
|
||||
Resource.o: Resource.cc Resource.h
|
||||
BaseDisplay.o: BaseDisplay.cc i18n.h BaseDisplay.h LinkedList.h \
|
||||
Timer.h
|
||||
Basemenu.o: Basemenu.cc i18n.h openbox.h BaseDisplay.h \
|
||||
|
@ -55,6 +53,7 @@ Configmenu.o: Configmenu.cc i18n.h Configmenu.h Basemenu.h \
|
|||
LinkedList.h Screen.h BaseDisplay.h Timer.h Iconmenu.h Netizen.h \
|
||||
Rootmenu.h Workspace.h Workspacemenu.h openbox.h Image.h \
|
||||
Window.h Windowmenu.h Slit.h Toolbar.h Resource.h Geometry.h
|
||||
Geometry.o: Geometry.cc Geometry.h
|
||||
Icon.o: Iconmenu.cc i18n.h openbox.h BaseDisplay.h LinkedList.h \
|
||||
Timer.h Image.h Window.h Iconmenu.h Basemenu.h Windowmenu.h Slit.h \
|
||||
Screen.h Configmenu.h Netizen.h Rootmenu.h Workspace.h \
|
||||
|
@ -66,6 +65,7 @@ Netizen.o: Netizen.cc Netizen.h BaseDisplay.h LinkedList.h Timer.h \
|
|||
Screen.h Configmenu.h Basemenu.h openbox.h Image.h Window.h \
|
||||
Iconmenu.h Windowmenu.h Slit.h Rootmenu.h Workspace.h \
|
||||
Workspacemenu.h Resource.h Geometry.h
|
||||
Resource.o: Resource.cc Resource.h Util.h
|
||||
Rootmenu.o: Rootmenu.cc openbox.h BaseDisplay.h LinkedList.h \
|
||||
Timer.h Image.h Window.h Iconmenu.h Basemenu.h Windowmenu.h Slit.h \
|
||||
Rootmenu.h Screen.h Configmenu.h Netizen.h Workspace.h \
|
||||
|
@ -95,7 +95,7 @@ Workspace.o: Workspace.cc i18n.h openbox.h BaseDisplay.h \
|
|||
LinkedList.h Timer.h Image.h Window.h Iconmenu.h Basemenu.h \
|
||||
Windowmenu.h Slit.h Clientmenu.h Workspace.h Screen.h \
|
||||
Configmenu.h Netizen.h Rootmenu.h Workspacemenu.h Toolbar.h Resource.h \
|
||||
Geometry.h Geometry.h
|
||||
Geometry.h Geometry.h Util.h
|
||||
Workspacemenu.o: Workspacemenu.cc i18n.h openbox.h BaseDisplay.h \
|
||||
LinkedList.h Timer.h Image.h Window.h Iconmenu.h Basemenu.h \
|
||||
Windowmenu.h Slit.h Screen.h Configmenu.h Netizen.h Rootmenu.h \
|
||||
|
@ -103,7 +103,8 @@ Workspacemenu.o: Workspacemenu.cc i18n.h openbox.h BaseDisplay.h \
|
|||
openbox.o: openbox.cc i18n.h openbox.h BaseDisplay.h \
|
||||
LinkedList.h Timer.h Image.h Window.h Iconmenu.h Basemenu.h \
|
||||
Windowmenu.h Slit.h Clientmenu.h Workspace.h Rootmenu.h \
|
||||
Screen.h Configmenu.h Netizen.h Workspacemenu.h Toolbar.h Resource.h Geometry.h
|
||||
Screen.h Configmenu.h Netizen.h Workspacemenu.h Toolbar.h Resource.h \
|
||||
Geometry.h Util.h
|
||||
bsd-snprintf.o: bsd-snprintf.c bsd-snprintf.h
|
||||
i18n.o: i18n.cc i18n.h
|
||||
main.o: main.cc ../version.h i18n.h openbox.h BaseDisplay.h \
|
||||
|
|
|
@ -390,8 +390,6 @@ distclean-local:
|
|||
|
||||
# local dependencies
|
||||
|
||||
Geometry.o: Geometry.cc Geometry.h
|
||||
Resource.o: Resource.cc Resource.h
|
||||
BaseDisplay.o: BaseDisplay.cc i18n.h BaseDisplay.h LinkedList.h \
|
||||
Timer.h
|
||||
Basemenu.o: Basemenu.cc i18n.h openbox.h BaseDisplay.h \
|
||||
|
@ -406,6 +404,7 @@ Configmenu.o: Configmenu.cc i18n.h Configmenu.h Basemenu.h \
|
|||
LinkedList.h Screen.h BaseDisplay.h Timer.h Iconmenu.h Netizen.h \
|
||||
Rootmenu.h Workspace.h Workspacemenu.h openbox.h Image.h \
|
||||
Window.h Windowmenu.h Slit.h Toolbar.h Resource.h Geometry.h
|
||||
Geometry.o: Geometry.cc Geometry.h
|
||||
Icon.o: Iconmenu.cc i18n.h openbox.h BaseDisplay.h LinkedList.h \
|
||||
Timer.h Image.h Window.h Iconmenu.h Basemenu.h Windowmenu.h Slit.h \
|
||||
Screen.h Configmenu.h Netizen.h Rootmenu.h Workspace.h \
|
||||
|
@ -417,6 +416,7 @@ Netizen.o: Netizen.cc Netizen.h BaseDisplay.h LinkedList.h Timer.h \
|
|||
Screen.h Configmenu.h Basemenu.h openbox.h Image.h Window.h \
|
||||
Iconmenu.h Windowmenu.h Slit.h Rootmenu.h Workspace.h \
|
||||
Workspacemenu.h Resource.h Geometry.h
|
||||
Resource.o: Resource.cc Resource.h Util.h
|
||||
Rootmenu.o: Rootmenu.cc openbox.h BaseDisplay.h LinkedList.h \
|
||||
Timer.h Image.h Window.h Iconmenu.h Basemenu.h Windowmenu.h Slit.h \
|
||||
Rootmenu.h Screen.h Configmenu.h Netizen.h Workspace.h \
|
||||
|
@ -446,7 +446,7 @@ Workspace.o: Workspace.cc i18n.h openbox.h BaseDisplay.h \
|
|||
LinkedList.h Timer.h Image.h Window.h Iconmenu.h Basemenu.h \
|
||||
Windowmenu.h Slit.h Clientmenu.h Workspace.h Screen.h \
|
||||
Configmenu.h Netizen.h Rootmenu.h Workspacemenu.h Toolbar.h Resource.h \
|
||||
Geometry.h Geometry.h
|
||||
Geometry.h Geometry.h Util.h
|
||||
Workspacemenu.o: Workspacemenu.cc i18n.h openbox.h BaseDisplay.h \
|
||||
LinkedList.h Timer.h Image.h Window.h Iconmenu.h Basemenu.h \
|
||||
Windowmenu.h Slit.h Screen.h Configmenu.h Netizen.h Rootmenu.h \
|
||||
|
@ -454,7 +454,8 @@ Workspacemenu.o: Workspacemenu.cc i18n.h openbox.h BaseDisplay.h \
|
|||
openbox.o: openbox.cc i18n.h openbox.h BaseDisplay.h \
|
||||
LinkedList.h Timer.h Image.h Window.h Iconmenu.h Basemenu.h \
|
||||
Windowmenu.h Slit.h Clientmenu.h Workspace.h Rootmenu.h \
|
||||
Screen.h Configmenu.h Netizen.h Workspacemenu.h Toolbar.h Resource.h Geometry.h
|
||||
Screen.h Configmenu.h Netizen.h Workspacemenu.h Toolbar.h Resource.h \
|
||||
Geometry.h Util.h
|
||||
bsd-snprintf.o: bsd-snprintf.c bsd-snprintf.h
|
||||
i18n.o: i18n.cc i18n.h
|
||||
main.o: main.cc ../version.h i18n.h openbox.h BaseDisplay.h \
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#include "Resource.h"
|
||||
#include "Util.h"
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "../config.h"
|
||||
|
@ -33,8 +34,6 @@
|
|||
# include <stdio.h>
|
||||
#endif // HAVE_STDIO_H
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
bool obResource::m_initialized = false;
|
||||
|
||||
obResource::obResource(const std::string &file) {
|
||||
|
@ -72,7 +71,7 @@ void obResource::setAutoSave(bool autosave) {
|
|||
}
|
||||
|
||||
void obResource::save() {
|
||||
assert(m_database != NULL);
|
||||
ASSERT(m_database != NULL);
|
||||
XrmPutFileDatabase(m_database, m_file.c_str());
|
||||
m_modified = false;
|
||||
}
|
||||
|
@ -87,7 +86,7 @@ bool obResource::load() {
|
|||
}
|
||||
|
||||
void obResource::setValue(const std::string &rname, bool value) {
|
||||
assert(m_database != NULL);
|
||||
ASSERT(m_database != NULL);
|
||||
|
||||
const char *val = (value ? "True" : "False");
|
||||
std::string rc_string = rname + ": " + val;
|
||||
|
@ -103,7 +102,7 @@ void obResource::setValue(const std::string &rname, int value) {
|
|||
}
|
||||
|
||||
void obResource::setValue(const std::string &rname, long value) {
|
||||
assert(m_database != NULL);
|
||||
ASSERT(m_database != NULL);
|
||||
|
||||
char val[11];
|
||||
sprintf(val, "%ld", value);
|
||||
|
@ -116,7 +115,7 @@ void obResource::setValue(const std::string &rname, long value) {
|
|||
}
|
||||
|
||||
void obResource::setValue(const std::string &rname, const char *value) {
|
||||
assert(m_database != NULL);
|
||||
ASSERT(m_database != NULL);
|
||||
|
||||
std::string rc_string = rname + ": " + value;
|
||||
XrmPutLineResource(&m_database, rc_string.c_str());
|
||||
|
@ -127,7 +126,7 @@ void obResource::setValue(const std::string &rname, const char *value) {
|
|||
}
|
||||
|
||||
void obResource::setValue(const std::string &rname, const std::string &value) {
|
||||
assert(m_database != NULL);
|
||||
ASSERT(m_database != NULL);
|
||||
|
||||
std::string rc_string = rname + ": " + value;
|
||||
XrmPutLineResource(&m_database, rc_string.c_str());
|
||||
|
@ -139,8 +138,8 @@ void obResource::setValue(const std::string &rname, const std::string &value) {
|
|||
|
||||
bool obResource::getValue(const std::string &rname, const std::string &rclass,
|
||||
bool &value) const {
|
||||
assert(rclass.c_str() != NULL);
|
||||
assert(m_database != NULL);
|
||||
ASSERT(rclass.c_str() != NULL);
|
||||
ASSERT(m_database != NULL);
|
||||
|
||||
char *rettype;
|
||||
XrmValue retvalue;
|
||||
|
@ -157,7 +156,7 @@ bool obResource::getValue(const std::string &rname, const std::string &rclass,
|
|||
|
||||
bool obResource::getValue(const std::string &rname, const std::string &rclass,
|
||||
long &value) const {
|
||||
assert(m_database != NULL);
|
||||
ASSERT(m_database != NULL);
|
||||
|
||||
char *rettype;
|
||||
XrmValue retvalue;
|
||||
|
@ -173,7 +172,7 @@ bool obResource::getValue(const std::string &rname, const std::string &rclass,
|
|||
|
||||
bool obResource::getValue(const std::string &rname, const std::string &rclass,
|
||||
std::string &value) const {
|
||||
assert(m_database != NULL);
|
||||
ASSERT(m_database != NULL);
|
||||
|
||||
char *rettype;
|
||||
XrmValue retvalue;
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
|
||||
#include <X11/Xatom.h>
|
||||
#include <X11/keysym.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "i18n.h"
|
||||
#include "openbox.h"
|
||||
|
|
32
src/Util.h
Normal file
32
src/Util.h
Normal file
|
@ -0,0 +1,32 @@
|
|||
// Util.h for Openbox
|
||||
// Copyright (c) 2002 - 2002 Ben Jansens (ben@orodu.net)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef __Util_hh
|
||||
#define __Util_hh
|
||||
|
||||
#ifdef DEBUG
|
||||
# include <assert.h>
|
||||
# define ASSERT(x) assert(x)
|
||||
#else // !DEBUG
|
||||
# define ASSERT(x)
|
||||
#endif // DEBUG
|
||||
|
||||
#endif // __Util_hh
|
|
@ -43,6 +43,7 @@
|
|||
#include "Workspace.h"
|
||||
#include "Windowmenu.h"
|
||||
#include "Geometry.h"
|
||||
#include "Util.h"
|
||||
|
||||
#ifdef HAVE_STDIO_H
|
||||
# include <stdio.h>
|
||||
|
@ -458,7 +459,7 @@ inline Point *Workspace::rowSmartPlacement(const Size &win_size,
|
|||
}
|
||||
|
||||
void Workspace::placeWindow(OpenboxWindow *win) {
|
||||
assert(win != NULL);
|
||||
ASSERT(win != NULL);
|
||||
|
||||
Bool placed = False;
|
||||
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
#include "Window.h"
|
||||
#include "Workspace.h"
|
||||
#include "Workspacemenu.h"
|
||||
#include "Util.h"
|
||||
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
|
@ -1209,9 +1210,9 @@ void Openbox::load_rc(void) {
|
|||
|
||||
|
||||
void Openbox::load_rc(BScreen *screen) {
|
||||
assert (screen != NULL);
|
||||
ASSERT (screen != NULL);
|
||||
const int screen_number = screen->getScreenNumber();
|
||||
assert (screen_number >= 0);
|
||||
ASSERT (screen_number >= 0);
|
||||
|
||||
if (!config.load())
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue