[Kde-pim] Review Request: KHolidays overhaul phase 1 - Restructure and new parser

John Layt johnlayt at googlemail.com
Sat Jan 23 21:42:37 GMT 2010


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.kde.org/r/2709/
-----------------------------------------------------------

Review request for KDE PIM.


Summary
-------

This change implements phase 1 of the overhaul of KHolidays.  It cleans up the file structures, adds some new public api, and adds a new parser which supports non-Gregorian calendar systems.  The library still uses the old parser for now, but will be switched in the next phase.

The holidays.h/.cpp files contained both the Holiday and HolidayRegion classes.  These needed to be split to prevent circular includes, however it is backwards-compatible as apps still only need to include holidays.h.  The following files were created using svn copy:

    kholidays/holiday_p.h   // HolidayPrivate class
    kholidays/holiday.h     // Holiday class
    kholidays/holiday.cpp
    kholidays/holidays.h    // Now only HolidayRegion class
    kholidays/holidays.cpp

(Perhaps also move HolidayRegion into holidayregion.h/.cpp with a placeholder holiday.h just including the other headers?

Interim methods have been added to the Holiday class to return the date of the holiday, and the < and > operators to allow the use of qSort().

New methods have been added to the HolidayRegion class to request a list of holidays by date range or calendar year.

An abstract parser driver class has been created to allow consistent access to different holiday file formats by the HolidayRegion class:

    kholidays/parsers/holidayparserdriver_p.h
    kholidays/parsers/holidayparserdriver.cpp

The old and new parsers have been placed in their own directories for clarity:

    kholidays/parsers/plan1/  // The old parser
    kholidays/parsers/plan2/  // The new parser

The old parser has been wrapped with a driver implementation to allow for continued parallel testing using the old holiday files:

    kholidays/parsers/plan1/holidayparserdriverplanold_p.h
    kholidays/parsers/plan1/holidayparserdriverplanold.cpp

The following files for the old parser were svn moved from kholidays/ and are not required to be reviewed:

    kholidays/parsers/plan1/scanholiday.lex
    kholidays/parsers/plan1/scanholiday.c
    kholidays/parsers/plan1/parseholiday.y
    kholidays/parsers/plan1/parseholiday.h
    kholidays/parsers/plan1/parseholiday.c
    kholidays/parsers/plan1/LICENSE.plan

The new parser has been implemented using the driver model and the Bison C++ skeleton:

    kholidays/parsers/plan1/holidayparserdriverplan_p.h
    kholidays/parsers/plan1/holidayparserdriverplan.cpp
    kholidays/parsers/plan2/holidayparserplan.ypp
    kholidays/parsers/plan2/holidayscannerplan.lpp

The following files for the new parser are generated by Bison/Flex and are not required to be reviewed:

    kholidays/parsers/plan2/holidayparserplan.hpp
    kholidays/parsers/plan2/holidayparserplan.cpp
    kholidays/parsers/plan2/holidayscannerplan.hpp
    kholidays/parsers/plan2/holidayscannerplan.cpp
    kholidays/parsers/plan2/stack.hh
    kholidays/parsers/plan2/location.hh
    kholidays/parsers/plan2/position.hh

The following test file were added:
    tests/testparseholiday.h
    tests/testparseholiday.cpp
    tests/testholidayregion.h
    tests/testholidayregion.cpp
    tests/holiday_old          // All the old holiday files combined for regression testing
    tests/holiday_test         // Sample file for new parser


Diffs
-----

  /trunk/KDE/kdepimlibs/kholidays/holidays.h 1079051 
  /trunk/KDE/kdepimlibs/kholidays/holidays.cpp 1079051 
  /trunk/KDE/kdepimlibs/kholidays/CMakeLists.txt 1079051 
  /trunk/KDE/kdepimlibs/kholidays/LICENSE.plan 1079051 
  /trunk/KDE/kdepimlibs/kholidays/holidays.h 1075911 
  /trunk/KDE/kdepimlibs/kholidays/holidays.cpp 1075911 
  /trunk/KDE/kdepimlibs/kholidays/holidays.cpp 1075911 
  /trunk/KDE/kdepimlibs/kholidays/parseholiday.h 1079051 
  /trunk/KDE/kdepimlibs/kholidays/parseholiday.c 1079051 
  /trunk/KDE/kdepimlibs/kholidays/parseholiday.y 1079051 
  /trunk/KDE/kdepimlibs/kholidays/parsers/holidayparserdriver.cpp PRE-CREATION 
  /trunk/KDE/kdepimlibs/kholidays/parsers/holidayparserdriver_p.h PRE-CREATION 
  /trunk/KDE/kdepimlibs/kholidays/parsers/plan1/holidayparserdriverplanold.cpp PRE-CREATION 
  /trunk/KDE/kdepimlibs/kholidays/parsers/plan1/holidayparserdriverplanold_p.h PRE-CREATION 
  /trunk/KDE/kdepimlibs/kholidays/parsers/plan2/README PRE-CREATION 
  /trunk/KDE/kdepimlibs/kholidays/parsers/plan2/holidayparserdriverplan.cpp PRE-CREATION 
  /trunk/KDE/kdepimlibs/kholidays/parsers/plan2/holidayparserdriverplan_p.h PRE-CREATION 
  /trunk/KDE/kdepimlibs/kholidays/parsers/plan2/holidayparserplan.hpp PRE-CREATION 
  /trunk/KDE/kdepimlibs/kholidays/parsers/plan2/holidayparserplan.cpp PRE-CREATION 
  /trunk/KDE/kdepimlibs/kholidays/parsers/plan2/holidayparserplan.ypp PRE-CREATION 
  /trunk/KDE/kdepimlibs/kholidays/parsers/plan2/holidayscannerplan.cpp PRE-CREATION 
  /trunk/KDE/kdepimlibs/kholidays/parsers/plan2/holidayscannerplan.lpp PRE-CREATION 
  /trunk/KDE/kdepimlibs/kholidays/parsers/plan2/location.hh PRE-CREATION 
  /trunk/KDE/kdepimlibs/kholidays/parsers/plan2/position.hh PRE-CREATION 
  /trunk/KDE/kdepimlibs/kholidays/parsers/plan2/stack.hh PRE-CREATION 
  /trunk/KDE/kdepimlibs/kholidays/scanholiday.c 1079051 
  /trunk/KDE/kdepimlibs/kholidays/scanholiday.lex 1079051 
  /trunk/KDE/kdepimlibs/kholidays/tests/CMakeLists.txt 1079051 
  /trunk/KDE/kdepimlibs/kholidays/tests/holiday_old PRE-CREATION 
  /trunk/KDE/kdepimlibs/kholidays/tests/holiday_test PRE-CREATION 
  /trunk/KDE/kdepimlibs/kholidays/tests/testparseholiday.h PRE-CREATION 
  /trunk/KDE/kdepimlibs/kholidays/tests/testparseholiday.cpp PRE-CREATION 

Diff: http://reviewboard.kde.org/r/2709/diff


Testing
-------

See unit tests for comparison testing between old and new parsers, and of the new HolidayRegion api.


Thanks,

John

_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/



More information about the kde-pim mailing list