• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

marble

  • sources
  • kde-4.14
  • kdeedu
  • marble
  • src
  • plugins
  • render
  • aprs
AprsFile.cpp
Go to the documentation of this file.
1 //
2 // This file is part of the Marble Virtual Globe.
3 //
4 // This program is free software licensed under the GNU LGPL. You can
5 // find a copy of this license in LICENSE.txt in the top directory of
6 // the source code.
7 //
8 // Copyright 2010 Wes Hardaker <hardaker@users.sourceforge.net>
9 //
10 
11 #include "AprsFile.h"
12 
13 #include <QFile>
14 
15 #include "MarbleDebug.h"
16 
17 #include "AprsGatherer.h"
18 
19 using namespace Marble;
20 
21 AprsFile::AprsFile( const QString &fileName )
22  : m_fileName( fileName ),
23  m_errorCount( 0 )
24 {
25 }
26 
27 AprsFile::~AprsFile()
28 {
29 }
30 
31 QString
32 AprsFile::sourceName() const
33 {
34  return QString( "File" );
35 }
36 
37 bool
38 AprsFile::canDoDirect() const
39 {
40  return true;
41 }
42 
43 QIODevice *
44 AprsFile::openSocket()
45 {
46  QFile *file = new QFile( m_fileName );
47 
48  mDebug() << "opening File socket";
49  if ( !file->open( QFile::ReadOnly ) ) {
50  mDebug() << "opening File failed";
51  delete file;
52  return 0;
53  }
54  mDebug() << "Opened " << m_fileName.toLocal8Bit().data();
55  return file;
56 }
57 
58 void
59 AprsFile::checkReadReturn( int length, QIODevice **socket,
60  AprsGatherer *gatherer )
61 {
62  Q_UNUSED( socket );
63  if ( length < 0 || ( length == 0 && m_errorCount > 5 ) ) {
64  gatherer->sleepFor( 1 ); // just wait for more
65  return;
66  }
67  if ( length == 0 ) {
68  ++m_errorCount;
69  mDebug() << "**** Odd: read zero bytes from File socket";
70  }
71  return;
72 }
QIODevice
Marble::AprsFile::canDoDirect
bool canDoDirect() const
Definition: AprsFile.cpp:38
Marble::AprsFile::openSocket
QIODevice * openSocket()
Definition: AprsFile.cpp:44
Marble::AprsFile::AprsFile
AprsFile(const QString &fileName)
Definition: AprsFile.cpp:21
MarbleDebug.h
AprsGatherer.h
QFile
Marble::AprsFile::checkReadReturn
void checkReadReturn(int length, QIODevice **socket, AprsGatherer *gatherer)
Definition: AprsFile.cpp:59
QString
QFile::open
virtual bool open(QFlags< QIODevice::OpenModeFlag > mode)
Marble::AprsFile::~AprsFile
~AprsFile()
Definition: AprsFile.cpp:27
QString::toLocal8Bit
QByteArray toLocal8Bit() const
AprsFile.h
Marble::AprsGatherer::sleepFor
static void sleepFor(int seconds)
Definition: AprsGatherer.cpp:285
QByteArray::data
char * data()
Marble::AprsGatherer
Definition: AprsGatherer.h:26
Marble::mDebug
QDebug mDebug()
a function to replace qDebug() in Marble library code
Definition: MarbleDebug.cpp:36
Marble::AprsFile::sourceName
QString sourceName() const
Definition: AprsFile.cpp:32
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:13:38 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

marble

Skip menu "marble"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal