summaryrefslogtreecommitdiff
authorkergoth <kergoth>2002-11-14 22:40:52 (UTC)
committer kergoth <kergoth>2002-11-14 22:40:52 (UTC)
commitec92de66e81b145119ff15bea0ad88436eb7bd4b (patch) (side-by-side diff)
treea65e8adc4edd60d7822f75e8b574e8e97596773c
parent3f1d60609657ea69bda453f5c820a23ee5375ab8 (diff)
downloadopie-ec92de66e81b145119ff15bea0ad88436eb7bd4b.zip
opie-ec92de66e81b145119ff15bea0ad88436eb7bd4b.tar.gz
opie-ec92de66e81b145119ff15bea0ad88436eb7bd4b.tar.bz2
namespace and include fix for uses of iostream in STL
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/oxygen/kmolcalc.cpp2
-rw-r--r--noncore/games/kbill/MCursor.cc6
-rw-r--r--noncore/games/kbill/Picture.cc6
-rw-r--r--noncore/unsupported/qpdf/QOutputDev.cpp12
4 files changed, 14 insertions, 12 deletions
diff --git a/noncore/apps/oxygen/kmolcalc.cpp b/noncore/apps/oxygen/kmolcalc.cpp
index 33666b1..1d41b0f 100644
--- a/noncore/apps/oxygen/kmolcalc.cpp
+++ b/noncore/apps/oxygen/kmolcalc.cpp
@@ -1,67 +1,67 @@
/*
* kmolcalc.cpp
*
* Copyright (C) 2000,2001 Tomislav Gountchev <tomi@idiom.com>
* Copyright (C) 2002 Carsten Niehaus <cniehaus@handhelds.org>
*/
/**
* KMOLCALC is the calculation engine. It knows about a hashtable of user defined atomic
* weights and group definitions ELSTABLE, and the currently processed formula, stored
* as a list of elements and their coefficients, ELEMENTS.
*/
#include "kmolcalc.h"
#include <qdict.h>
#include <qdir.h>
#include <qfile.h>
#include <qpe/qpeapplication.h>
-#include <iostream.h>
+#include <iostream>
/**
* Construct a new calculator object.
*/
KMolCalc::KMolCalc() {
elements = new ElementList;
elstable = NULL;
readElstable();
}
KMolCalc::~KMolCalc() {
delete elements;
}
void KMolCalc::readElstable() {
weight = -1; // not calculated yet
if (elstable) delete elstable;
elstable = new QDict<SubUnit> (197, TRUE);
elstable->setAutoDelete(TRUE);
mwfile = QPEApplication::qpeDir() +"share/oxygen/kmolweights";
QFile f(mwfile);
if (f.exists()) readMwfile(f);
}
/**
* Parse a string S and construct the ElementList this->ELEMENTS, representing the
* composition of S. Returns 0 if successful, or an error code (currently -1) if
* parsing failed.
* The elements is S must be valid element or group symbols, as stored in this->ELSTABLE.
* See help files for correct formula syntax.
*/
QString KMolCalc::readFormula(const QString& s) {
weight = -1;
if (elements) delete elements;
elements = new ElementList;
return KMolCalc::readGroup(s, elements);
}
// read a formula group recursively. Called by readFormula.
QString KMolCalc::readGroup(const QString& s, ElementList* els) {
if (s.isEmpty()) return QString ("Enter a formula."); //ERROR
int sl = s.length();
int i = 0;
QString errors ("OK");
bool ok = TRUE;
while (i < sl && ((s[i] <= '9' && s[i] >= '0') || s[i] == '.')) i++;
diff --git a/noncore/games/kbill/MCursor.cc b/noncore/games/kbill/MCursor.cc
index 30f7577..a3cb340 100644
--- a/noncore/games/kbill/MCursor.cc
+++ b/noncore/games/kbill/MCursor.cc
@@ -1,69 +1,69 @@
/***************************************************************************
MCursor.cc - description
-------------------
begin : Thu Dec 30 1999
copyright : (C) 1999 by Jurrien Loonstra
email : j.h.loonstra@st.hanze.nl
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "MCursor.h"
#include "objects.h"
#include <qcursor.h>
#include <qbitmap.h>
#include <qwidget.h>
#include <qstring.h>
#ifdef KDEVER
#include <kapp.h>
#include <kstandarddirs.h>
#endif
-#include <iostream.h>
+#include <iostream>
#include <qpe/resource.h>
MCursor::~MCursor() {
delete cursor;
}
void MCursor::load(const char *name, int masked) {
#ifdef KDEVER
QString file, mfile;
KStandardDirs dirs;
file = dirs.findResource("data","kbill/bitmaps/" + QString::fromLocal8Bit(name) + ".xbm");
QBitmap bitmap, mask;
if (bitmap.load(file) == FALSE) {
- cerr << "cannot open " << file << endl;
+ std::cerr << "cannot open " << file << std::endl;
exit(1);
}
if (masked == SEP_MASK) {
// mfile.sprintf ("%sbitmaps/%s_mask.xbm", (const char*)dir, name);
mfile = file = dirs.findResource("data","kbill/bitmaps/" + QString::fromLocal8Bit(name) + "_mask.xbm");
if (mask.load(mfile) == FALSE) {
- cerr << "cannot open " << file << endl;
+ std::cerr << "cannot open " << file << std::endl;
exit(1);
}
}
else
mask = bitmap;
#endif
QBitmap bitmap, mask;
bitmap = Resource::loadBitmap("kbill/bitmaps/" + QString::fromLocal8Bit(name));
if (masked == SEP_MASK)
mask = bitmap = Resource::loadBitmap("kbill/bitmaps/" + QString::fromLocal8Bit(name) + "_mask.xbm");
else
mask = bitmap;
cursor = new QCursor(bitmap, mask, bitmap.width() / 2, bitmap.height() / 2);
}
diff --git a/noncore/games/kbill/Picture.cc b/noncore/games/kbill/Picture.cc
index 79e19ba..fe0eff8 100644
--- a/noncore/games/kbill/Picture.cc
+++ b/noncore/games/kbill/Picture.cc
@@ -1,72 +1,72 @@
/***************************************************************************
Picture.cc - description
-------------------
begin : Thu Dec 30 1999
copyright : (C) 1999 by Jurrien Loonstra
email : j.h.loonstra@st.hanze.nl
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "Picture.h"
#include "objects.h"
-#include <iostream.h>
+#include <iostream>
#include <qstring.h>
#include <qpe/resource.h>
#ifdef KDEVER
#include <kapp.h>
#include <kstandarddirs.h>
#include <kdebug.h>
#endif
void Picture::load(const char *name, int index) {
//QString dir = KApplication::kde_datadir(), file;
// QString dir = locate("data",""),file;
// dir += "/kbill/";
// if (index>=0)
// file.sprintf ("%spixmaps/%s_%d.xpm", (const char *)dir, name, index);
// else
// file.sprintf("%spixmaps/%s.xpm", (const char *)dir, name);
#ifdef KDEVER
KStandardDirs dirs;
QString file;
if (index>=0) {
//kdDebug() << "Here";
QString sindex;
sindex.setNum(index);
// kdDebug() << "kbill/pixmaps/" + QString::fromLocal8Bit(name) + "_" + sindex + ".xpm";
file = dirs.findResource("data","kbill/pixmaps/" + QString::fromLocal8Bit(name) + "_" + sindex + ".xpm");
} else {
file = dirs.findResource("data","kbill/pixmaps/" + QString::fromLocal8Bit(name) + ".xpm");
}
- kdDebug() << file << endl;
+ kdDebug() << file << std::endl;
pix = new QPixmap();
if (pix->load(file) == FALSE)
- cerr << "cannot open " << file << endl;
+ std::cerr << "cannot open " << file << std::endl;
width = pix->width();
height = pix->height();
#endif
QString sindex;
pix = new QPixmap();
sindex.setNum(index);
if (index>=0)
pix->load(Resource::findPixmap("kbill/pixmaps/" + QString::fromLocal8Bit(name) +"_"+ sindex));
else
pix->load(Resource::findPixmap("kbill/pixmaps/" + QString::fromLocal8Bit(name)));
width = pix->width();
height = pix->height();
}
QPixmap* Picture::getPixmap() {
return pix;
}
diff --git a/noncore/unsupported/qpdf/QOutputDev.cpp b/noncore/unsupported/qpdf/QOutputDev.cpp
index f587a33..52237f5 100644
--- a/noncore/unsupported/qpdf/QOutputDev.cpp
+++ b/noncore/unsupported/qpdf/QOutputDev.cpp
@@ -1,69 +1,71 @@
///========================================================================
//
// QOutputDev.cc
//
// Copyright 1996 Derek B. Noonburg
// CopyRight 2002 Robert Griebl
//
//========================================================================
#ifdef __GNUC__
#pragma implementation
#endif
#include <aconf.h>
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <unistd.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
+#include <iostream>
+
#include "GString.h"
#include "Object.h"
#include "Stream.h"
#include "Link.h"
#include "GfxState.h"
#include "GfxFont.h"
#include "UnicodeMap.h"
#include "CharCodeToUnicode.h"
#include "FontFile.h"
#include "Error.h"
#include "TextOutputDev.h"
#include "QOutputDev.h"
#include <qpixmap.h>
#include <qimage.h>
#include <qpainter.h>
#include <qdict.h>
#include <qtimer.h>
#include <qapplication.h>
#include <qclipboard.h>
//#define QPDFDBG(x) x // special debug mode
#define QPDFDBG(x) // normal compilation
//------------------------------------------------------------------------
// Constants and macros
//------------------------------------------------------------------------
static inline QColor q_col ( const GfxRGB &rgb )
{
return QColor ( lrint ( rgb. r * 255 ), lrint ( rgb. g * 255 ), lrint ( rgb. b * 255 ));
}
//------------------------------------------------------------------------
// Font substitutions
//------------------------------------------------------------------------
struct QOutFontSubst {
char * m_name;
char * m_sname;
bool m_bold;
bool m_italic;
QFont::StyleHint m_hint;
};
@@ -625,97 +627,97 @@ void QOutputDev::drawChar ( GfxState *state, fp_t x, fp_t y,
// check for invisible text -- this is used by Acrobat Capture
if (( state-> getRender ( ) & 3 ) == 3 ) {
return;
}
x -= originX;
y -= originY;
state-> transform ( x, y, &x1, &y1 );
state-> transformDelta ( dx, dy, &dx1, &dy1 );
if ( uLen > 0 ) {
QString str;
QFontMetrics fm = m_painter-> fontMetrics ( );
for ( int i = 0; i < uLen; i++ ) {
QChar c = QChar ( u [i] );
if ( fm. inFont ( c )) {
str [i] = QChar ( u [i] );
}
else {
str [i] = ' ';
QPDFDBG( printf ( "CHARACTER NOT IN FONT: %hx\n", c. unicode ( )));
}
}
if (( uLen == 1 ) && ( str [0] == ' ' ))
return;
fp_t m11, m12, m21, m22;
state-> getFontTransMat ( &m11, &m12, &m21, &m22 );
m11 *= state-> getHorizScaling ( );
m12 *= state-> getHorizScaling ( );
fp_t fsize = m_painter-> font ( ). pixelSize ( );
#ifndef QT_NO_TRANSFORMATIONS
QWMatrix oldmat;
bool dorot = (( m12 < -0.1 ) || ( m12 > 0.1 )) && (( m21 < -0.1 ) || ( m21 > 0.1 ));
if ( dorot ) {
oldmat = m_painter-> worldMatrix ( );
- cerr << endl << "ROTATED: " << m11 << ", " << m12 << ", " << m21 << ", " << m22 << " / SIZE: " << fsize << " / TEXT: " << str. local8Bit ( ) << endl << endl;
+ std::cerr << std::endl << "ROTATED: " << m11 << ", " << m12 << ", " << m21 << ", " << m22 << " / SIZE: " << fsize << " / TEXT: " << str. local8Bit ( ) << endl << endl;
QWMatrix mat ( lrint ( m11 / fsize ), lrint ( m12 / fsize ), -lrint ( m21 / fsize ), -lrint ( m22 / fsize ), lrint ( x1 ), lrint ( y1 ));
m_painter-> setWorldMatrix ( mat );
x1 = 0;
y1 = 0;
}
#endif
QPen oldpen = m_painter-> pen ( );
if (!( state-> getRender ( ) & 1 )) {
QPen fillpen = oldpen;
fillpen. setColor ( m_painter-> brush ( ). color ( ));
m_painter-> setPen ( fillpen );
}
if ( fsize > 5 )
m_painter-> drawText ( lrint ( x1 ), lrint ( y1 ), str );
else
m_painter-> fillRect ( lrint ( x1 ), lrint ( y1 ), lrint ( QMAX( fp_t(1), dx1 )), lrint ( QMAX( fsize, dy1 )), m_painter-> pen ( ). color ( ));
m_painter-> setPen ( oldpen );
#ifndef QT_NO_TRANSFORMATIONS
if ( dorot )
m_painter-> setWorldMatrix ( oldmat );
#endif
QPDFDBG( printf ( "DRAW TEXT: \"%s\" at (%ld/%ld)\n", str. local8Bit ( ). data ( ), lrint ( x1 ), lrint ( y1 )));
}
else if ( code != 0 ) {
// some PDF files use CID 0, which is .notdef, so just ignore it
qWarning ( "Unknown character (CID=%d Unicode=%hx)\n", code, (unsigned short) ( uLen > 0 ? u [0] : (Unicode) 0 ));
}
qApp-> processEvents ( );
}
void QOutputDev::drawImageMask ( GfxState *state, Object */*ref*/, Stream *str, int width, int height, GBool invert, GBool inlineImg )
{
// get CTM, check for singular matrix
fp_t *ctm = state-> getCTM ( );
if ( fabs ( ctm [0] * ctm [3] - ctm [1] * ctm [2] ) < 0.000001 ) {
@@ -732,98 +734,98 @@ void QOutputDev::drawImageMask ( GfxState *state, Object */*ref*/, Stream *str,
return;
}
GfxRGB rgb;
state-> getFillRGB ( &rgb );
uint val = ( lrint ( rgb. r * 255 ) & 0xff ) << 16 | ( lrint ( rgb. g * 255 ) & 0xff ) << 8 | ( lrint ( rgb. b * 255 ) & 0xff );
QImage img ( width, height, 32 );
img. setAlphaBuffer ( true );
QPDFDBG( printf ( "IMAGE MASK (%dx%d)\n", width, height ));
// initialize the image stream
ImageStream *imgStr = new ImageStream ( str, width, 1, 1 );
imgStr-> reset ( );
uchar **scanlines = img. jumpTable ( );
if ( ctm [3] > 0 )
scanlines += ( height - 1 );
for ( int y = 0; y < height; y++ ) {
QRgb *scanline = (QRgb *) *scanlines;
if ( ctm [0] < 0 )
scanline += ( width - 1 );
for ( int x = 0; x < width; x++ ) {
Guchar alpha;
imgStr-> getPixel ( &alpha );
if ( invert )
alpha ^= 1;
*scanline = ( alpha == 0 ) ? 0xff000000 | val : val;
ctm [0] < 0 ? scanline-- : scanline++;
}
ctm [3] > 0 ? scanlines-- : scanlines++;
qApp-> processEvents ( );
}
#ifndef QT_NO_TRANSFORMATIONS
QWMatrix mat ( ctm [0] / width, ctm [1], ctm [2], ctm [3] / height, ctm [4], ctm [5] );
- cerr << "MATRIX T=" << mat. dx ( ) << "/" << mat. dy ( ) << endl
- << " - M=" << mat. m11 ( ) << "/" << mat. m12 ( ) << "/" << mat. m21 ( ) << "/" << mat. m22 ( ) << endl;
+ std::cerr << "MATRIX T=" << mat. dx ( ) << "/" << mat. dy ( ) << std::endl
+ << " - M=" << mat. m11 ( ) << "/" << mat. m12 ( ) << "/" << mat. m21 ( ) << "/" << mat. m22 ( ) << std::endl;
QWMatrix oldmat = m_painter-> worldMatrix ( );
m_painter-> setWorldMatrix ( mat, true );
#ifdef QWS
QPixmap pm;
pm. convertFromImage ( img );
m_painter-> drawPixmap ( 0, 0, pm );
#else
m_painter-> drawImage ( QPoint ( 0, 0 ), img );
#endif
m_painter-> setWorldMatrix ( oldmat );
#else
if (( ctm [1] < -0.1 ) || ( ctm [1] > 0.1 ) || ( ctm [2] < -0.1 ) || ( ctm [2] > 0.1 )) {
QPDFDBG( printf ( "### ROTATED / SHEARED / ETC -- CANNOT DISPLAY THIS IMAGE\n" ));
}
else {
int x = lrint ( ctm [4] );
int y = lrint ( ctm [5] );
int w = lrint ( ctm [0] );
int h = lrint ( ctm [3] );
if ( w < 0 ) {
x += w;
w = -w;
}
if ( h < 0 ) {
y += h;
h = -h;
}
QPDFDBG( printf ( "DRAWING IMAGE MASKED: %d/%d - %dx%d\n", x, y, w, h ));
img = img. smoothScale ( w, h );
qApp-> processEvents ( );
m_painter-> drawImage ( x, y, img );
}
#endif
delete imgStr;
qApp-> processEvents ( );
}
@@ -861,98 +863,98 @@ void QOutputDev::drawImage(GfxState *state, Object */*ref*/, Stream *str, int wi
QPDFDBG( printf ( "IMAGE (%dx%d)\n", width, height ));
// initialize the image stream
ImageStream *imgStr = new ImageStream ( str, width, nComps, nBits );
imgStr-> reset ( );
Guchar pixBuf [gfxColorMaxComps];
GfxRGB rgb;
uchar **scanlines = img. jumpTable ( );
if ( ctm [3] > 0 )
scanlines += ( height - 1 );
for ( int y = 0; y < height; y++ ) {
QRgb *scanline = (QRgb *) *scanlines;
if ( ctm [0] < 0 )
scanline += ( width - 1 );
for ( int x = 0; x < width; x++ ) {
imgStr-> getPixel ( pixBuf );
colorMap-> getRGB ( pixBuf, &rgb );
uint val = ( lrint ( rgb. r * 255 ) & 0xff ) << 16 | ( lrint ( rgb. g * 255 ) & 0xff ) << 8 | ( lrint ( rgb. b * 255 ) & 0xff );
if ( maskColors ) {
for ( int k = 0; k < nComps; ++k ) {
if (( pixBuf [k] < maskColors [2 * k] ) || ( pixBuf [k] > maskColors [2 * k] )) {
val |= 0xff000000;
break;
}
}
}
*scanline = val;
ctm [0] < 0 ? scanline-- : scanline++;
}
ctm [3] > 0 ? scanlines-- : scanlines++;
qApp-> processEvents ( );
}
#ifndef QT_NO_TRANSFORMATIONS
QWMatrix mat ( ctm [0] / width, ctm [1], ctm [2], ctm [3] / height, ctm [4], ctm [5] );
- cerr << "MATRIX T=" << mat. dx ( ) << "/" << mat. dy ( ) << endl
- << " - M=" << mat. m11 ( ) << "/" << mat. m12 ( ) << "/" << mat. m21 ( ) << "/" << mat. m22 ( ) << endl;
+ std::cerr << "MATRIX T=" << mat. dx ( ) << "/" << mat. dy ( ) << std::endl
+ << " - M=" << mat. m11 ( ) << "/" << mat. m12 ( ) << "/" << mat. m21 ( ) << "/" << mat. m22 ( ) << std::endl;
QWMatrix oldmat = m_painter-> worldMatrix ( );
m_painter-> setWorldMatrix ( mat, true );
#ifdef QWS
QPixmap pm;
pm. convertFromImage ( img );
m_painter-> drawPixmap ( 0, 0, pm );
#else
m_painter-> drawImage ( QPoint ( 0, 0 ), img );
#endif
m_painter-> setWorldMatrix ( oldmat );
#else // QT_NO_TRANSFORMATIONS
if (( ctm [1] < -0.1 ) || ( ctm [1] > 0.1 ) || ( ctm [2] < -0.1 ) || ( ctm [2] > 0.1 )) {
QPDFDBG( printf ( "### ROTATED / SHEARED / ETC -- CANNOT DISPLAY THIS IMAGE\n" ));
}
else {
int x = lrint ( ctm [4] );
int y = lrint ( ctm [5] );
int w = lrint ( ctm [0] );
int h = lrint ( ctm [3] );
if ( w < 0 ) {
x += w;
w = -w;
}
if ( h < 0 ) {
y += h;
h = -h;
}
QPDFDBG( printf ( "DRAWING IMAGE: %d/%d - %dx%d\n", x, y, w, h ));
img = img. smoothScale ( w, h );
qApp-> processEvents ( );
m_painter-> drawImage ( x, y, img );
}
#endif
delete imgStr;
qApp-> processEvents ( );
}