LCOV - code coverage report
Current view: top level - shumate - shumate-utils.c (source / functions) Hit Total Coverage
Test: Code coverage Lines: 0 22 0.0 %
Date: 2024-05-11 21:41:31 Functions: 0 6 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 8 0.0 %

           Branch data     Line data    Source code
       1                 :            : /*
       2                 :            :  * Copyright (C) 2023 James Westman <james@jwestman.net>
       3                 :            :  *
       4                 :            :  * This library is free software; you can redistribute it and/or
       5                 :            :  * modify it under the terms of the GNU Lesser General Public
       6                 :            :  * License as published by the Free Software Foundation; either
       7                 :            :  * version 2.1 of the License, or (at your option) any later version.
       8                 :            :  *
       9                 :            :  * This library is distributed in the hope that it will be useful,
      10                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      11                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      12                 :            :  * Lesser General Public License for more details.
      13                 :            :  *
      14                 :            :  * You should have received a copy of the GNU Lesser General Public
      15                 :            :  * License along with this library; if not, see <https://www.gnu.org/licenses/>.
      16                 :            :  */
      17                 :            : 
      18                 :            : #include "shumate-utils-private.h"
      19                 :            : 
      20                 :            : void
      21                 :          0 : shumate_grid_position_init (ShumateGridPosition *self,
      22                 :            :                             int                  x,
      23                 :            :                             int                  y,
      24                 :            :                             int                  zoom)
      25                 :            : {
      26                 :          0 :   self->x = x;
      27                 :          0 :   self->y = y;
      28                 :          0 :   self->zoom = zoom;
      29                 :          0 : }
      30                 :            : 
      31                 :            : ShumateGridPosition *
      32                 :          0 : shumate_grid_position_new (int x,
      33                 :            :                            int y,
      34                 :            :                            int zoom)
      35                 :            : {
      36                 :          0 :   ShumateGridPosition *self = g_new0 (ShumateGridPosition, 1);
      37                 :          0 :   shumate_grid_position_init (self, x, y, zoom);
      38                 :          0 :   return self;
      39                 :            : }
      40                 :            : 
      41                 :            : ShumateGridPosition *
      42                 :          0 : shumate_grid_position_copy (ShumateGridPosition *pos)
      43                 :            : {
      44                 :          0 :   return shumate_grid_position_new (pos->x, pos->y, pos->zoom);
      45                 :            : }
      46                 :            : 
      47                 :            : guint
      48                 :          0 : shumate_grid_position_hash (gconstpointer pointer)
      49                 :            : {
      50                 :          0 :   const ShumateGridPosition *self = pointer;
      51                 :          0 :   return self->x ^ self->y ^ self->zoom;
      52                 :            : }
      53                 :            : 
      54                 :            : gboolean
      55                 :          0 : shumate_grid_position_equal (gconstpointer a, gconstpointer b)
      56                 :            : {
      57                 :          0 :   const ShumateGridPosition *pos_a = a;
      58                 :          0 :   const ShumateGridPosition *pos_b = b;
      59   [ #  #  #  #  :          0 :   return pos_a->x == pos_b->x && pos_a->y == pos_b->y && pos_a->zoom == pos_b->zoom;
                   #  # ]
      60                 :            : }
      61                 :            : 
      62                 :            : void
      63                 :          0 : shumate_grid_position_free (gpointer pointer)
      64                 :            : {
      65                 :          0 :   ShumateGridPosition *self = pointer;
      66         [ #  # ]:          0 :   if (!self)
      67                 :            :     return;
      68                 :            : 
      69                 :          0 :   g_free (self);
      70                 :            : }
      71                 :            : 

Generated by: LCOV version 1.14