Questions tagged [wrapper]

A wrapper is an OOP technique where an object encapsulates (wraps) another object, hiding/protecting the object and controlling all access to it.

Filter by
Sorted by
Tagged with
15
votes
1answer
529 views

Event-based Xbox Controller polling

The goal of the following code is to be able to use an Xbox Controller in a Java program, it works with the jinput library. Unfortunately this library is rather old, has little to no documentation ...
3
votes
1answer
125 views

RAII style API wrapper for PyMongo

I just watched Raymond Hettinger's talk on making Python more Pythonic and realized I should be putting a lot of his ideas into practice, particularly wrapping API's in a class that makes everything ...
4
votes
2answers
580 views

Encryption wrapper

I am writing an encryption class using Crypto++. The idea is that the client connects using RSA (encrypt, decrypt) with username, password, 32 byte key. The server will then return using the stream ...
3
votes
2answers
585 views

BigDecimal wrapper that ignores zero operands

I want to perform mathematical operations on a range of values, where zeros should be ignored. This means that multiplication by zero does not result in zero but returns the first operand and likewise ...
2
votes
1answer
64 views

Simple DB API for inserting a record

I'm looking to make some improvements to a deliberately crude API written in PHP, it's designed to handle simple requests and talk to the DB. I have the following DB class: ...
2
votes
2answers
409 views

PDO wrapper with validation

After moving from mysql_ to PDO I created a PDO handling function. Basically this function takes parameters, checks them and returns end result. The thing is that I created this ~1 year ago and haven'...
2
votes
1answer
213 views

Throwing exceptions in a database wrapper

I hope the extension methods ThrowArgumentNullExceptionIfNullOrEmpty and ThrowNullReferenceExceptionIfNullOrEmpty are ...
4
votes
1answer
740 views

Wrapper library for Google Static Maps API

I've recently read the books Clean Code and Effective Java. I am a huge fan of Object-Oriented Java. I am trying to write as professionally as possible. I have been an Android Developer for 20 months ...
5
votes
2answers
2k views

C++/CLI wrapper around a C library

I have a C library written by a third-party company. It calculates photo positions on a book page, position of a photo inside an area (which part of the photo to crop), it fills a book with random ...
3
votes
3answers
3k views

Simple wrapper for LocalReport

I've built a wrapper for a LocalReport and I would like to hear your suggestions about it: ...
3
votes
3answers
1k views

PDO class and security

I have started a project in PHP with PDO and I'm almost done, but I've read somewhere that PDO escape alone is not secure and we have to consider some settings of PDP. I am a little confused about my ...
1
vote
1answer
1k views

Write to the event log without needing to check whether or not it exists by use of a `-Force` parameter

Below is some powershell to write to the event log; if the -Force parameter is specified this saves you the effort of writing additional code to first check whether ...
4
votes
3answers
980 views

WinSCP IDisposable Wrapper

I have written a simple wrapper for WinSCP in C#. I have written it to simplify SFTP connections I will needing to perform. ...
7
votes
2answers
577 views

Scala BitSet implemented with Java BitSet, for use in Scala Enumerations to replace ValueSet

Due to a performance profiling hotspot detailed here, I implemented my own BitSet using Java's BitSet. This is intended to ...
2
votes
2answers
797 views

“Rational” Wrapper class with support for Rational Number Approximation

Enough with imprecise floating point datatypes called float anddouble. I present to you Rational. Of course, Rational number ...
2
votes
1answer
407 views

Point2D.Double wrapper

I have made a Point2D.Double wrapper so I can add my own functionality (like a dominate method) and alter some (like ...
5
votes
1answer
402 views

Python wrapper for official Hacker News API

Since Hacker News launched their official API, I started working on Python wrapper for it. API v0 is fairly simple, you send a GET request with hacker news story's ID or user id, it returns data in ...
3
votes
1answer
3k views

A wrapper class for Sessions in PHP

I have been using $_SESSION, $_POST, $_GET, $_SERVER ...
4
votes
1answer
74 views

Thin proxy class for hashables

I need some kind of thin wrapper object to mark dictionary keys, like: d = { Required('name'): str, Optional('age'): int, } And these wrappers should behave ...
6
votes
1answer
411 views

Debug log wrapper

I will be adding functionality and most likely additional refactoring, however a stringent review would be welcome before I build it further. I know documentation is probably a bit sparse but, you ...
11
votes
2answers
3k views

Async wrapper around public API

Tear it apart. I'm mostly concerned around the appropriate use of ConfigureAwait(false), and possible poor handling and duplication of the ...
3
votes
1answer
366 views

Neo4J Rest Javascript wrapper

As a toy project, I started evaluating the Neo4J graph database and its Rest interface. I'm trying to write a simple graph visualization in JavaScript. In daily business I'm a Java developer and maybe ...
11
votes
1answer
586 views

Set of wrapper functions for POSIX signal APIs on Linux

Please feel free to comment on the accuracy/validity of the following wrapper source for processing signals using the new POSIX sigaction API. If you feel I'm doing anything wrong or potentially ...
10
votes
1answer
374 views

Correct usage of alignas in std::ostringstream wrapper

Please take a look at this code: ...
7
votes
1answer
2k views

OpenGL object wrapped in a Qt Widget

I have this object wrapper class, which I will use to implement my Qt OpenGL scene. It is working, but I am looking for a way to: Improve the API. Remove extra OpenGL calls. Optimize it. I know that ...
5
votes
1answer
1k views

PHP wrapper around an API - best practices

Here's a PHP wrapper around a public OAuth2 REST API. I would love to hear your thoughts and comments. Testing was a bit frustrating since I tried for my first time. Not sure if I have done the ...
3
votes
2answers
1k views

Structure of API wrapper

I'm building an API wrapper for a bookkeeping SOAP API. I have some questions regarding bast practice for structure of the wrapper and for error handling. For now i've structured it like this: ...
4
votes
1answer
4k views

Creating a reusable C#.NET Oracle Query Builder

I write a metric ton of queries for an Oracle environment every day. These are reports that often require multiple separate queries that no end of joins and sub-queries will satisfy, hence lots of ...
6
votes
2answers
797 views

Critique of realloc() wrapper

Seeking code correctness and best practices. I would like to re-allocate various amounts of memory (0 or more) such that on systems that may return NULL for an ...
5
votes
2answers
5k views

Wrapper around default shared preferences in Android

Retrieving an instance of (Default) SharedPreferences and then calling the six methods that may be called to put/get a value gets pretty old pretty quickly, so I ...
1
vote
1answer
758 views

Wrapper for caching methods in ASP.NET

I have written a caching wrapper method for some of my services. The actual wrapper method is written as follows: ...

1 2
3