32 Cache* Cache::m_pInstance=
nullptr;
37 m_pInstance=
new Cache;
44 routeCache = cache +
"RouteCache" + QDir::separator();
45 geoCache = cache +
"GeocoderCache"+ QDir::separator();
46 placemarkCache = cache +
"PlacemarkCache" + QDir::separator();
55 if(cache.isNull()|cache.isEmpty())
63 #ifdef DEBUG_GetGeocoderFromCache
64 qDebug()<<
"Entered GetGeocoderFromCache";
67 QString filename=geoCache+QString(urlEnd)+
".geo";
68 #ifdef DEBUG_GetGeocoderFromCache
69 qDebug()<<
"GetGeocoderFromCache: Does file exist?:"<<filename;
71 QFileInfo File(filename);
74 #ifdef DEBUG_GetGeocoderFromCache
75 qDebug()<<
"GetGeocoderFromCache:File exists!!";
78 if (file.open(QIODevice::ReadOnly))
80 QTextStream stream(&file);
81 stream.setCodec(
"UTF-8");
82 ret = stream.readAll();
85 #ifdef DEBUG_GetGeocoderFromCache
86 qDebug()<<
"GetGeocoderFromCache:Returning:"<<ret;
93 QString filename=geoCache+QString(urlEnd)+
".geo";
95 qDebug()<<
"CacheGeocoder: Filename:"<<filename;
97 QFileInfo File(filename);;
98 QDir dir=File.absoluteDir();
99 QString path=dir.absolutePath();
101 qDebug()<<
"CacheGeocoder: Path:"<<path;
106 qDebug()<<
"CacheGeocoder: Cache path doesn't exist, try to create";
108 if(!dir.mkpath(path))
111 qDebug()<<
"GetGeocoderFromCache: Could not create path";
116 qDebug()<<
"CacheGeocoder: OpenFile:"<<filename;
118 QFile
file(filename);
119 if (file.open(QIODevice::WriteOnly))
122 qDebug()<<
"CacheGeocoder: File Opened!!!:"<<filename;
124 QTextStream stream(&file);
125 stream.setCodec(
"UTF-8");
132 qDebug()<<
"Entered GetPlacemarkFromCache";
135 QString filename=placemarkCache+QString(urlEnd)+
".plc";
137 qDebug()<<
"GetPlacemarkFromCache: Does file exist?:"<<filename;
139 QFileInfo File(filename);
143 qDebug()<<
"GetPlacemarkFromCache:File exists!!";
145 QFile
file(filename);
146 if (file.open(QIODevice::ReadOnly))
148 QTextStream stream(&file);
149 stream.setCodec(
"UTF-8");
150 ret = stream.readAll();
154 qDebug()<<
"GetPlacemarkFromCache:Returning:"<<ret;
161 QString filename=placemarkCache+QString(urlEnd)+
".plc";
163 qDebug()<<
"CachePlacemark: Filename:"<<filename;
165 QFileInfo File(filename);;
166 QDir dir=File.absoluteDir();
167 QString path=dir.absolutePath();
169 qDebug()<<
"CachePlacemark: Path:"<<path;
174 qDebug()<<
"CachePlacemark: Cache path doesn't exist, try to create";
176 if(!dir.mkpath(path))
179 qDebug()<<
"CachePlacemark: Could not create path";
184 qDebug()<<
"CachePlacemark: OpenFile:"<<filename;
186 QFile
file(filename);
187 if (file.open(QIODevice::WriteOnly))
190 qDebug()<<
"CachePlacemark: File Opened!!!:"<<filename;
192 QTextStream stream(&file);
193 stream.setCodec(
"UTF-8");