/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
template <> struct ParamTraits<nsIDOMGeoPositionCoords*> { // Function to serialize a geoposition staticvoid Write(MessageWriter* aWriter, nsIDOMGeoPositionCoords* aParam) { bool isNull = !aParam;
WriteParam(aWriter, isNull); // If it is a null object, then we are done if (isNull) return;
// Function to de-serialize a geoposition staticbool Read(MessageReader* aReader,
RefPtr<nsIDOMGeoPositionCoords>* aResult) { // Check if it is the null pointer we have transfered bool isNull; if (!ReadParam(aReader, &isNull)) returnfalse;
// It's not important to us where it fails, but rather if it fails if (!(ReadParam(aReader, &latitude) && ReadParam(aReader, &longitude) &&
ReadParam(aReader, &altitude) && ReadParam(aReader, &accuracy) &&
ReadParam(aReader, &altitudeAccuracy) &&
ReadParam(aReader, &heading) && ReadParam(aReader, &speed))) returnfalse;
// We now have all the data
*aResult = new nsGeoPositionCoords(latitude, /* aLat */
longitude, /* aLong */
altitude, /* aAlt */
accuracy, /* aHError */
altitudeAccuracy, /* aVError */
heading, /* aHeading */
speed /* aSpeed */
); returntrue;
}
};
template <> struct ParamTraits<nsIDOMGeoPosition*> { // Function to serialize a geoposition staticvoid Write(MessageWriter* aWriter, nsIDOMGeoPosition* aParam) { bool isNull = !aParam;
WriteParam(aWriter, isNull); // If it is a null object, then we are done if (isNull) return;
// Function to de-serialize a geoposition staticbool Read(MessageReader* aReader, RefPtr<nsIDOMGeoPosition>* aResult) { // Check if it is the null pointer we have transfered bool isNull; if (!ReadParam(aReader, &isNull)) returnfalse;
// It's not important to us where it fails, but rather if it fails if (!ReadParam(aReader, &timeStamp) || !ReadParam(aReader, &coords)) { returnfalse;
}
*aResult = new nsGeoPosition(coords, timeStamp);
returntrue;
};
};
} // namespace IPC
#endif
¤ Dauer der Verarbeitung: 0.1 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.