Evince
Evince is a document viewer capable of displaying multiple and single page document formats like PDF and Postscript.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
EvBrowserPlugin.cpp File Reference
#include "config.h"
#include "EvBrowserPlugin.h"
#include "EvBrowserPluginToolbar.h"
#include "npfunctions.h"
#include <errno.h>
#include <gtk/gtkx.h>
#include <limits>
#include <string.h>
+ Include dependency graph for EvBrowserPlugin.cpp:

Go to the source code of this file.

Data Structures

struct  EvBrowserPluginClass
 

Functions

template<typename IntegerType >
static void parseInteger (const char *strValue, IntegerType &intValue)
 
static void parseDouble (const char *strValue, double &doubleValue)
 
static void parseBoolean (const char *strValue, bool &boolValue)
 
static void parseZoomMode (const char *strValue, EvSizingMode &sizingModeValue)
 

Function Documentation

static void parseBoolean ( const char *  strValue,
bool &  boolValue 
)
inlinestatic

Definition at line 135 of file EvBrowserPlugin.cpp.

136 {
137  if (!strValue)
138  return;
139 
140  unique_gptr<char> value(g_ascii_strdown(strValue, -1));
141  if (g_ascii_strcasecmp(value.get(), "false") == 0 || g_ascii_strcasecmp(value.get(), "no") == 0)
142  boolValue = false;
143  else if (g_ascii_strcasecmp(value.get(), "true") == 0 || g_ascii_strcasecmp(value.get(), "yes") == 0)
144  boolValue = true;
145  else {
146  int intValue = boolValue;
147  parseInteger<int>(strValue, intValue);
148  boolValue = intValue > 0;
149  }
150 }

+ Here is the caller graph for this function:

static void parseDouble ( const char *  strValue,
double &  doubleValue 
)
inlinestatic

Definition at line 123 of file EvBrowserPlugin.cpp.

124 {
125  if (!strValue)
126  return;
127 
128  char *endPtr = nullptr;
129  errno = 0;
130  double value = g_ascii_strtod(strValue, &endPtr);
131  if (endPtr != strValue && errno == 0)
132  doubleValue = value;
133 }

+ Here is the caller graph for this function:

template<typename IntegerType >
static void parseInteger ( const char *  strValue,
IntegerType &  intValue 
)
inlinestatic

Definition at line 108 of file EvBrowserPlugin.cpp.

109 {
110  static const IntegerType intMax = std::numeric_limits<IntegerType>::max();
111  static const bool isSigned = std::numeric_limits<IntegerType>::is_signed;
112 
113  if (!strValue)
114  return;
115 
116  char *endPtr = nullptr;
117  errno = 0;
118  gint64 value = isSigned ? g_ascii_strtoll(strValue, &endPtr, 0) : g_ascii_strtoull(strValue, &endPtr, 0);
119  if (endPtr != strValue && errno == 0 && value <= intMax)
120  intValue = static_cast<IntegerType>(value);
121 }
static void parseZoomMode ( const char *  strValue,
EvSizingMode sizingModeValue 
)
inlinestatic

Definition at line 152 of file EvBrowserPlugin.cpp.

153 {
154  if (!strValue)
155  return;
156 
157  unique_gptr<char> value(g_ascii_strdown(strValue, -1));
158  if (g_ascii_strcasecmp(value.get(), "none") == 0)
159  sizingModeValue = EV_SIZING_FREE;
160  else if (g_ascii_strcasecmp(value.get(), "fit-page") == 0)
161  sizingModeValue = EV_SIZING_FIT_PAGE;
162  else if (g_ascii_strcasecmp(value.get(), "fit-width") == 0)
163  sizingModeValue = EV_SIZING_FIT_WIDTH;
164  else if (g_ascii_strcasecmp(value.get(), "auto") == 0)
165  sizingModeValue = EV_SIZING_AUTOMATIC;
166 }

+ Here is the caller graph for this function: